Friday, June 12, 2009

Linking statically with Xerces C++ on Mac OS 10.5

Xerces C++ 3.01 automatically builds static and dynamic libraries as well. There are three things you will need to do in order to successfully link such a static library to your application:

- If you build Xerces-C++ with the network support (the default) then you will need to link to the curl library
- You need to specify the following g++ options: -Wl,-framework -Wl,CoreServices
- You need to add libxerces-c.a to the linker

Example:

g++ -Wl,-framework -Wl,CoreServices -o "DLog++" ./src/DLog++.o ./src/debug.o ./src/owl_parser.o /usr/local/lib/libxerces-c.a -lcurl


For the same thing under windows check this out: http://wiki.codesynthesis.com/Xerces_tips