Archived

This forum has been archived. Please start a new discussion on GitHub.

Validate.cpp doesn't compile against xerces 2.2.0

Hi,

Yes, I realize that the install guide specified xerces 2.1.0, but if I'm going to be downloading 6MB, I'll be getting the latest ;)

Also, this might not be due to the version difference, but the way your xerces is configured compared to mine.

Anyway, the problem is that in my xerces build, namespaces are required for all xerces types. This means that src/slice2xsd/Validate.cpp will currently fail to build.

What I did was to put "XERCES_CPP_NAMESPACE_USE" one line beneath "using namespace std;". This is a xerces macro that expands to the correct "using namespace" statement for xerces, but only if xerces was configured to use namespaces.

It built okay after that!

This is on SuSE 8.0, on a Pentium box, with gcc 3.2.1.

Here's the first part of the compiler error report:
c++ -c -I. -I../../include  -I/home/derekt/e2fsprogs-1.32/lib  -g -ftemplate-depth-128 -fPIC -Wall Validate.cpp
Validate.cpp: In function `std::string toString(const XMLCh*)':
Validate.cpp:36: `XMLString' undeclared (first use this function)
Validate.cpp:36: (Each undeclared identifier is reported only once for each 
   function it appears in.)
Validate.cpp:36: parse error before `::' token
Validate.cpp: At global scope:
Validate.cpp:43: parse error before `{' token
Validate.cpp:51: parse error before `&' token

... and it goes on like this.

Regards,
Derek.

PS. I am not a crackpot!

Comments

  • Thanks for the fix Derek.

    I found I had to make the same fix to the following files to get it working:
    src/IceSSL/ConfigParser.h
    src/IceSSL/ConfigParserErrorReporter.h
    src/IceStorm/Admin.cpp
    src/IceStorm/WeightedGraph.cpp
    src/IcePack/ComponentBuilder.h
    src/IcePack/IcePackNode.cpp
    src/IcePack/IcePackRegistry.cpp
    src/XMLTransform/ErrorReporter.h
    include/XMLTransform/XMLTransform.h

    ... but it is all working now and I have the hello demo working.
  • Originally posted by Bruce
    Thanks for the fix Derek.

    I found I had to make the same fix to the following files to get it working:
    src/IceSSL/ConfigParser.h
    src/IceSSL/ConfigParserErrorReporter.h
    src/IceStorm/Admin.cpp
    src/IceStorm/WeightedGraph.cpp
    src/IcePack/ComponentBuilder.h
    src/IcePack/IcePackNode.cpp
    src/IcePack/IcePackRegistry.cpp
    src/XMLTransform/ErrorReporter.h
    include/XMLTransform/XMLTransform.h

    ... but it is all working now and I have the hello demo working.

    I also found I had to include the header file XMLException.hpp in Validator.cpp.

    Shouldn't the namespace fix just go into the cpp files, not the header files? Otherwise the headers have a side effect.

    -apm
  • Originally posted by marlowa

    I also found I had to include the header file XMLException.hpp in Validator.cpp.

    Shouldn't the namespace fix just go into the cpp files, not the header files? Otherwise the headers have a side effect.

    -apm

    That's right, but unfortunately some xerces identifiers are used in Ice header files. You could do something lam0r like requiring that the 'using namespace' declaration appear before each '#include' of an affected file, but that is bad practice as the include files aren't independently compilable any more.

    The *best* way would be to fully qualify every single xerces identifer used in a header, but I just don't have time right now, and it's not going to affect my mucking about. I just wanted to build it! I'll leave such niceties to the good people at ZeroC :)

    In short, stick to xerces 2.1.0 for now. I just like being on the bleeding edge ;)

    Regards,
    Derek.
  • Xerces 2.1.0 is no good - it is far too buggy (I had to fix some bugs myself). 2.2.0 is live now, so can we please have a fix to use it?
  • Originally posted by Colin Adams
    Xerces 2.1.0 is no good - it is far too buggy (I had to fix some bugs myself). 2.2.0 is live now, so can we please have a fix to use it?

    We port Ice to xerces 2.2.0 as we speak (or write?).
  • Yes it works now, but the Make.rules file is a bit mis-leading on this. The standard place to find Xerces-c is the directory pointed to by the XERCESCROOT environment variable. A comment in the Make.rules file to say that this is not used might help.