[Insight-developers] VTK_USE_ANSI_STDLIB confusion

Robert Tamburo rjtst21 at pitt . edu
Fri, 23 May 2003 14:45:53 -0400


Our application is built on ITK/VTK/FLTK. Everything was fine until VTK was
built with VTK_USE_ANSI_STDLIB set to "ON".

Here's a small sample of the errors:
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'
D:\VTK\Common\vtkIOStream.h(44) : error C2874: using-declaration causes a
multiple declaration of 'cerr'
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iostream(19) :
see declaration of 'cerr'
D:\VTK\Common\vtkIOStream.h(45) : error C2874: using-declaration causes a
multiple declaration of 'cout'
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iostream(18) :
see declaration of 'cout'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\ios.h(104) : error
C2371: 'ostream' : redefinition; different basic types
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(257) :
see declaration of 'ostream'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\ios.h(106) : error
C2371: 'ios' : redefinition; different basic types
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(254) :
see declaration of 'ios'

I'm confused for several reasons. First of course being that ITK is not
supposed to build with
VTK_USE_ANSI_STDLIB  to "ON" as testified in:
http://www . itk . org/cgi-bin/InsightFAQ/InsightFAQ?query=ansi&querytype=simple&casefold=yes&req=search
http://www . itk . org/pipermail/insight-users/2003-April/003313 . html
http://public . kitware . com/pipermail/insight-users/2002-March/000192 . html)
....but I have no problems building ITK or our app with this flag set to
"OFF"

As per the suggestions in the FAQ:
"If the compile/link error is in an application that is trying to use ITK,
the solution is usually to include an ITK header file before any other
include file. This forces whatever include files that the application may
use to use the Standard Library streams library. "
http://www . itk . org/cgi-bin/InsightFAQ/InsightFAQ?query=ostream&querytype=simple&casefold=yes&req=search
.........I moved all ITK includes before any other include files and the
problem still persists.

Any help in understanding this behavior would be greatly appreciated.

-Rob