[vtkusers] about the conflict between the new IO and the old IO

Yixun Liu yxliu at fudan.edu.cn
Tue Aug 3 05:42:24 EDT 2004


Thank Luis,
Like you said, I enable the VTK_USE_ANSI_LIB ON and remove the #include old IO header in my app. It is Ok now.
At the beginnig, I am puzzled because I can use  both the new and old IO in the same app(due to the std namespace), however, when I use the VTK and the old IO, the compiler alwayse report redefinition error. At last I look at the vtk header and I find that vtk define the "use std::ofstream"
to make  the same code to work with ansi  and old-style streams. Just this definition cause the conflict between the old and the new IO in the same app.
----- Original Message ----- 
From: "Luis Ibanez" <luis.ibanez at kitware.com>
To: "Yixun Liu" <yxliu at fudan.edu.cn>
Cc: <vtkusers at vtk.org>; <insight-users at itk.org>
Sent: Tuesday, August 03, 2004 12:13 PM
Subject: Re: [vtkusers] about the conflict between the new IO and the old IO


> 
> Hi Yixun,
> 
> You should simply enable the use of ANSI_STDLIB
> when configuring VTK.
> 
> Chances are that you are mixing new and old
> #includes for header files in your application.
> 
> Please identify a minimal piece of code where
> you observer this behavior and post the code
> to the list.
> 
> 
>    Thanks
> 
> 
>      Luis
> 
> 
> 
> ----------------------
> Yixun Liu wrote:
> 
> > Hi ITKUsers and VTKusers,
> >  
> >             I need use ITK+VTK, so I build them both with the 
> > "use_ansi_stdlib" ON. However, one of my programs which once worked fine 
> > with the VTK(the parameter "use_ansi_lib" is Off) can not work. The 
> > compile error is:
> >  
> > 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'
> >  
> > I think the reason is that the conflict between the new IO and the old 
> > IO, so I add the #undef VTK_USE_ANSI_STDLIB in my program, but the 
> > compiler report the same error. If I build the VTK with the 
> > "use_ansi_lib" Off and add the #define VTK_USE_ANSI_STDLIB in my 
> > programm, I think, I can resolve this problem. However, I need use the 
> > VTK with the ITK, if I build the VTK with 'use_ansi_lib" Off, I have to 
> > build the ITK with the same configuration. I do not want to do like 
> > this.  Can I have other choices to resolve the conflict between the old 
> > IO and the new IO?
> >  
> > Thank you in advance!
> >  
> > Best regards,
> >  
> > Yixun Liu
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > This is the private VTK discussion list. 
> > Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> 
> 
> 



More information about the vtkusers mailing list