[Insight-users] ITK vs VC++ Conflict in stream files?

Luis Ibanez luis . ibanez at kitware . com
Tue, 20 Aug 2002 08:35:03 -0400


Hi Martin,

VC++ offers support for both the
old and new iostream libraries.

The traditional library use the header
#include <iostream.h> and do not use
namespaces.

The new library use the header
#include <iostream>   // without ".h"
and use the namespace "std".
So, what previously was "cout" now
is "std::cout".


The selection between both libraries is
not done by checking a check-box in some
menu option as anybody would like but by
the following quite-fuzzy rule:

   "If you include first <iostream.h> the
   traditional iostream library will be used,
   if you include first <iostream> then the
   new libraries will be used."


ITK use the new iostream library and takes
advantage of namespaces.

When you combine ITK code with your project
you have to make sure that an ITK header
is the first to be included.  ITK headers
will make sure that <iostream> is included
before any <iostream.h> you may have in your
project. (or that may exist in the other
libraries used by your project).

Note that in addition to making sure that
an ITK header is included first, you may
want to start using the new headers and
start using namespaces.


Please let us know if you have further questions.


   Thanks


    Luis



=================================================

martin.garcia@epfl.ch wrote:
> Hi everybody,
> 
> I've finally managed to compile ITK, but I've met a problem when I tried to add 
> itk functionalities to my project.
> 
> Adding #include "itkImage.h"
> 
> causes the following comipaltion erros (I'm working on VC++ & Windows 2000 
> Professional)
> 
> 
> Compiling...
> OsirisActiveXView.cpp
> c:\program files\microsoft visual studio\vc98\include\strstream(51) : error 
> C2039: 'seekdir' : is not a member of 'ios'
>         c:\program files\microsoft visual studio\vc98\include\ios.h(106) : see 
> declaration of 'ios'
> c:\program files\microsoft visual studio\vc98\include\strstream(51) : error 
> C2061: syntax error : identifier 'seekdir'
> c:\program files\microsoft visual studio\vc98\include\strstream(54) : error 
> C2039: 'openmode' : is not a member of 'ios'
>         c:\program files\microsoft visual studio\vc98\include\ios.h(106) : see 
> declaration of 'ios'
> c:\program files\microsoft visual studio\vc98\include\strstream(54) : error 
> C2061: syntax error : identifier 'openmode'
> c:\program files\microsoft visual studio\vc98\include\strstream(91) : error 
> C2629: unexpected 'class std::ostrstream ('
> c:\program files\microsoft visual studio\vc98\include\strstream(91) : error 
> C2238: unexpected token(s) preceding ';'
> c:\program files\microsoft visual studio\vc98\include\strstream(109) : error 
> C2629: unexpected 'class std::strstream ('
> c:\program files\microsoft visual studio\vc98\include\strstream(109) : error 
> C2238: unexpected token(s) preceding ';'
> d:\insightbeta2\code\common\itkvector.h(21) : fatal error C1083: Cannot open 
> include file: 'vnl/vnl_vector_ref.h': No such file or directory
> Error executing cl.exe.
> 
> OsirisLight.exe - 9 error(s), 0 warning(s)
> 
> Can anybody help me with this problem?
> 
> 
> Thanks
> 
> 
> 
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
> 
>