Xerces and OpenCascade


I just finished a sax-parser with xerces, this should now generate geometry using OpenCascade.
When Including the first OpenCascade Header file I get the warning about WNT and added
/D WNT to the compiler options. But then I get a bunch of errors like those below.

How could I use xerces and OpenCascade within the same project ?

Thanks, Carsten

Mehrdeutiges Symbol = Ambiguous Symbol

c:\OpenCASCADE6.1.0\ros\inc\Standard_Storable.hxx(101): error C2872: 'ostream': Mehrdeutiges Symbol
c:\OpenCASCADE6.1.0\ros\inc\Standard_Storable.hxx(146): error C2872: 'ostream': Mehrdeutiges Symbol
c:\OpenCASCADE6.1.0\ros\inc\Standard_Transient_proto.hxx(52): error C2872: 'ostream': Mehrdeutiges Symbol
c:\OpenCASCADE6.1.0\ros\inc\Handle_Standard_Transient.hxx(92): error C2872: 'ostream': Mehrdeutiges Symbol
c:\OpenCASCADE6.1.0\ros\inc\Handle_Standard_Transient.hxx(96): error C2872: 'ostream': Mehrdeutiges Symbol
c:\OpenCASCADE6.1.0\ros\inc\Handle_Standard_Transient.hxx(203): error C2872: 'ostream': Mehrdeutiges Symbol
c:\OpenCASCADE6.1.0\ros\inc\TopLoc_Location.hxx(178): error C2872: 'ostream': Mehrdeutiges Symbol
c:\OpenCASCADE6.1.0\ros\inc\TopLoc_Location.hxx(218): error C2872: 'ostream': Mehrdeutiges Symbol
c:\OpenCASCADE6.1.0\ros\inc\Standard_Type.hxx(115): error C2872: 'ostream': Mehrdeutiges Symbol

CloneX's picture

I encountered the same thing when trying to integrate some OpenCASCADE code into our current VC++ 6.0 project. In my case it occurred because the old code used old style headers (#include ) while OpenCASCADE uses the new style (#include ). Apparently the two cannot coexist. Changing all our old code to use the new headers was too large an undertaking so I ended up putting the OpenCASCADE based code in a DLL. Check your Xerces build and make sure it uses the new style headers.

Hope that helps,


Rob Bachrach's picture

The header conflict is a problem. However, you can force OCC to reference the old headers on WNT systems by defining USE_OLD_STREAMS your project settings. For verification, you can look at Standard_Stream.hxx in the OCC install.

CloneX's picture

Thanks for the tip. I can now link OpenCASCADE directly into my application!!

Carsten Zerbst's picture


thanks for all answers. After some search I found that the log4cxx header files
contains the following typedefs

typedef std::basic_string String;
typedef std::basic_ostream ostream;
typedef std::basic_istream istream;

They conflict then with the ostream and istream used by opencascade.