compile errors... never heard about them?

hi all,
i've just installed openCascade to add iges support
in my app, but when i try to build the whole project,
it gets stuck with errors like:

In file included from /usr/local/include/OpenCascade/Handle_XSControl_WorkSession.hxx:29,
from /usr/local/include/OpenCascade/IGESControl_Reader.hxx:26,
from /home/enrico/exrstereoviewer/exrstereoviewer/Include/translator.h:25,
from translator.cpp:17:
/usr/local/include/OpenCascade/Standard.hxx:94: `ostream' was not declared in
this scope
/usr/local/include/OpenCascade/Standard.hxx:94: `S' was not declared in this
scope
/usr/local/include/OpenCascade/Standard.hxx:94: invalid data member
initialization
/usr/local/include/OpenCascade/Standard.hxx:94: (use `=' to initialize static
data members)
/usr/local/include/OpenCascade/Standard.hxx:94: variable or field `
StorageManagerDump' declared void
/usr/local/include/OpenCascade/Standard.hxx:96: `ostream' was not declared in
this scope
/usr/local/include/OpenCascade/Standard.hxx:96: `anOut' was not declared in
this scope
/usr/local/include/OpenCascade/Standard.hxx:96: parse error before `aTypeName'

since all of them are in the opencascade headers, i suspect
that something in my setup went wrong. I have little clues,
so any help will be gratefully received.
Thx th G.

Rob Bachrach's picture

If you used "configure" to build your libraries you need to compile
your project code with "-DHAVE_CONFIG_H". This tells the OpenCASCADE
headers to load the config.h that defines where the streams come from
(and other stuff).

gunslinger's picture

thanks rob,
i tried to include the -DHAVE_CONFIG_H in my program
configures, but it didn't help overcoming the problem.
my errors are quite the same:

In file included from /usr/local/opt/OpenCASCADE5.2/ros/inc/Standard_OutOfRange.hxx:33,
from /usr/local/opt/OpenCASCADE5.2/ros/inc/TCollection_Array1.lxx:1,
from /usr/local/opt/OpenCASCADE5.2/ros/inc/TColStd_Array1OfInteger.hxx:134,
from /usr/local/include/OpenCascade/Poly_Connect.hxx:29,
from /home/enrico/exrstereoviewer/exrstereoviewer/Include/translator.h:30,
from translator.cpp:17:
/usr/local/opt/OpenCASCADE5.2/ros/inc/Standard_SStream.hxx:36: parse error
before `{' token
/usr/local/opt/OpenCASCADE5.2/ros/inc/Standard_SStream.hxx:40: parse error
before `&' token
/usr/local/opt/OpenCASCADE5.2/ros/inc/Standard_SStream.hxx:41: destructors must
be member functions
/usr/local/opt/OpenCASCADE5.2/ros/inc/Standard_SStream.hxx:42: parse error
before `}' token

and so on. I am getting these errors compiling MY app, not the
openCascade sources. For OpenCascade i simply dnloaded the
public files and launched the executable.

Thx again,
the G.

Rob Bachrach's picture

OK. If you look in Standard_SStream.hxx, you will see the following
logic (I added the indentation):

#ifndef WNT
#ifdef HAVE_CONFIG_H
#include
#endif
#ifdef HAVE_IOSTREAM
#include
#include
using namespace std;
#define USE_STL_STREAM
#elif defined (HAVE_IOSTREAM_H)
#include
#include
#endif
#else

You will note that, assuming WNT (windows NT) is not set, there is
an if and an elseif to include the proper header files, but no else.
Therefore, you must have one of the following for this to work:

HAVE_CONFIG_H: if configure was used to build OpenCASCADE
HAVE_IOSTREAM: if using the new STL header files
HAVE_IOSTREAM_H: if using the old STL header files

Since you downloaded the precompiled code, I am guessing that
configure was not used to build it (probably wok). So you need to
set one of the other two based on the age of your compiler and STL.

Granted I think this is either a coding error or a documentation
error on the part of the OpenCASCADE development team, but the
appropriate compiler switch should work.

Good luck,
Rob

Rob Bachrach's picture

Sorry, the mail forum took out my indentation in the previous
response, but you get the idea.
Rob