[vtkusers] ANSI C++ stdlib issue (windows), precompiled header ?

Sebastien BARRE seb-ml-vtk at barre.nom.fr
Mon Oct 9 19:41:18 EDT 2000

At 16/09/00 09:06, Will Schroeder wrote:

>BTW, individual VTK objects file generated with the ANSI support are much 
>larger (and it takes even more time to compile the lib). My Windows 
>vtkdll/obj is 266 Mb large.
>The final library itself is larger.

All right, here are some more (interesting ?) details.

The good news is that I was able to use the MTL/ITL inside VTK.
The bad news is that enabling VTK ANSI stdlib has, to say the least, a 
disastrous impact on compile time.

Example. 8 classes, on a Pentium II @ 300 Mhz, 200 RAM, NT4 + MSVC 6.0

without VTK ANSI stdlib support:
DLL build time : 45 s.
overall obj's size : 2478 Ko
resulting precompiled header size : 4301 Ko

with VTK ANSI stdlib support:
DLL build time : 86 s.
overall obj's size : 3243 Ko
resulting precompiled header size : 9499 Ko

Yes, my dear fellows, compilation is *two times* slower on my computer with 
ANSI support (too bad, I wanted to replace my PII at 300 with an Ahtlon at 800 
this week :()

What freaks me out is that I'm quite sure this whole burden comes from the 
ANSI templated iostream stuff. *grin*

I guess it could compile faster if the precompiled header was handled 
correctly, but it's rebuilt for each file on my configuration, which 
actually slows done the whole stuff ! (flags /YX). The Consistency Rules 
for the /YX flag are not very clear, I do not know what I'm doing wrong : 
even if I issue a simple "touch *.cxx" the precompiled header is rebuild 
for every file, again and again (4 to 9 megabytes overhead for each source 
file, thanks a lot).

For the moment there is no way to build the VTK library without ANSI 
support, and build your own lib with ANSI support on the other hand (and 
vice-versa). As you will have to link your lib against the VTK lib, the 
linker will complain like this :

vtksbNearestPoint.obj : error LNK2001: unresolved external symbol "public: 
virtual void __thiscall vtkAbstractTransform::PrintSelf(class ostream 
&,class vtkIndent)" 
(?PrintSelf at vtkAbstractTransform@@UAEXAAVostream@@VvtkIndent@@@Z)

where vtksbNearestPoint is part of my lib (here compiled without ANSI). It 
expects PrintSelf from vtkAbstractTransform. But it looks like this in the 
VTK lib :

  (public: virtual void __thiscall vtkAbstractTransform::PrintSelf(class 
std::basic_ostream<char,struct std::char_traits<char> > &,class vtkIndent))

yes, the difference is in the iostream stuff :(

I do need Ansi support, but two times slower, jesus...

More information about the vtkusers mailing list