Mihai Matei wrote:
Hi, thanks for the reply.

If I don't specify the libraries at link time, I get unresolved symbols.

Then there's something wrong with the way you're compiling and linking.


And I tried modifying some parameters to get Xerces to build with the new 
standard library, but the result was the same: broken sample binaries.

You need to determine what the default is for the compiler version and platform you're using and make sure everything is consistent. The samples have a separate set of Makefiles, so you may need to make sure you've updated everything consistently. I've built both -Aa and -AA binaries before, so it is possible.


Although I tried using a vector in a test program that does some xml operations using Xerces, 
and turns out I don't have to compile with -AA to get <vector> to work. When you say 
"the old standard library", are you referring to the one that uses the old header 
files, iostream.h for example?

Yes. That version of the library is not in the std namespace, and from your previous post, it seemed to me you wanted the version that _is_ in the std namespace. But remember that there is some inconsistency with the header files. If you include <vector>, you either get the version of vector that is not in the standard namespace, or the one that is, based on the -A flag. On the other hand, you can still use iostream.h with the -AA switch. That results in the inclusion of <iostream>, along with the using directive "using namespace std;" That's probably not what you want.

You probably want to do something like this:

#include <vector>

#if defined(_HP_NAMESPACE_STD)
#include <iostream>
#else
#include <iostream.h>
#endif

int
main()
{
#if defined(_HP_NAMESPACE_STD)
    std::vector<int> foo;

    foo.push_back(3);
    std::cout << foo[0];
#else
    vector<int>  foo;

    foo.push_back(3);
    cout << foo[0];
#endif

    return 0;
}

To get this to work consistently with Xerces-C, you may need to update the HP compiler configuration file (src/xercesc/util/Compilers/HPCCDefs.hpp) and add some magic:

#if defined(_HP_NAMESPACE_STD)
#define XERCES_NEW_IOSTREAMS
#endif

Dave

Reply via email to