[vtkusers] Problems building VTK - can't find strstream.h ???

Peter F Bradshaw pfb at exadios.com
Mon Dec 12 23:01:59 EST 2005


Hi Teresa;

On Mon, 12 Dec 2005, Palmer, Teresa wrote:

> Hi,
>
>
>
> I have tried to build VTK-4.2 on CentOS 4.2 (glibc 2.3.4).  However,
> there was nothing created in the bin directory but an error was logged
> in CMakeError.log which says it can't find strstream.h.  The same error
> was found downloading VTK-4.4. Here is the error log:
>
>
>
> -- error from CMakeError.log ----
>
>
>
> gmake[3]: Entering directory `/opt/vtk/VTK/CMakeTmp'
>
> Building CXX object CMakeFiles/cmTryCompileExec.dir/CheckIncludeFile.o
>
> c++   -o CMakeFiles/cmTryCompileExec.dir/CheckIncludeFile.o -
>
> c /opt/vtk/VTK/CMakeTmp/CheckIncludeFile.cxx
>
> /opt/vtk/VTK/CMakeTmp/CheckIncludeFile.cxx:1:23: strstream.h: No such
> file or directory
>
> gmake[3]: *** [CMakeFiles/cmTryCompileExec.dir/CheckIncludeFile.o] Error
> 1
>
> gmake[3]: Leaving directory `/opt/vtk/VTK/CMakeTmp'
>
> gmake[2]: *** [CMakeFiles/cmTryCompileExec.dir/all] Error 2
>
> gmake[2]: Leaving directory `/opt/vtk/VTK/CMakeTmp'
>
> gmake[1]: *** [CMakeFiles/cmTryCompileExec.dir/rule] Error 2
>
> gmake[1]: Leaving directory `/opt/vtk/VTK/CMakeTmp'
>
> gmake: *** [cmTryCompileExec] Error 2
>
>
>
> On searching for strstream on the hardrive:
>
>
>
> /usr/include/c++/3.4.3/backward/strstream

But "strstream.h" != "strstream"

The real problem is that there have been a number of changes in the
standard C++ development environment. One of the changes is that the
header files of our old favorites (stream.h, fstream.h, ...) are now
included by the name without the ".h". So now its '#include <stream>'
etc. In addition strstream.h and strstream are now obsolete. The header
you really need is sstream.

I would look at the 'ifdefs' around the 'include' in order to find out
what it takes to include sstream. For instance (this from VTK V4.5):

// Use ANSI ostrstream or ostringstream.
#ifdef VTK_USE_ANSI_STDLIB
# ifndef VTK_NO_ANSI_STRING_STREAM
#  include <sstream>
using std::ostringstream;
# else
#  include <strstream>
using std::ostrstream;
using std::ends;
.
.
.

Here, in order to get sstream, VTK_USE_ANSI_STDLIB needs to be defined
and VTK_NO_ANSI_STRING_STREAM needs to be undefined. It should be just
a matter of setting the CMake vars accordingly.

Failing that it may be possible to write your own strstream.h and put
it in a place that the compiler will look. For instance:

#ifndef _CPP_BACKWARD_STRSTREAM_H
#define _CPP_BACKWARD_STRSTREAM_H 1

#include "backward_warning.h"
#include "sstream"

#endif

However, its hard to predict what other follow on problems this later
approach might cause!

>
>
>
> Any ideas anyone?
>
>
>
> Thanks
>
>
>
>
>
>

Cheers

-- 
Peter F Bradshaw, http://www.exadios.com, ICQ 75431157 (exadios).
Public key at www.exadios.com/pfb.pgp.key and www.exadios.com/pfb.gpg.key
"I love truth, and the way the government still uses it occasionally to
 keep us guessing." - Sam Kekovich.



More information about the vtkusers mailing list