Hi, everyone!

When I'm building my project on Visual Studio 2008 that uses Xerces, I have the following linker errors:

2>XmlPersistingService.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl xercesc_2_8::XMLPlatformUtils::Initialize(char const * const,char const * const,class xercesc_2_8::PanicHandler * const,class xercesc_2_8::MemoryManager * const,bool)" (__imp_?Initialize@XMLPlatformUtils@xercesc_2_8@@SAXQEBD0QEAVPanicHandler@2@QEAVMemoryManager@2@_N@Z) referenced in function "public: __cdecl XmlPersistingService::XmlPersistingService(char const *)" (??0XmlPersistingService@@QEAA@PEBD@Z)
2>XmlPersistingService.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static char const * const xercesc_2_8::XMLUni::fgXercescDefaultLocale" (__imp_?fgXercescDefaultLocale@XMLUni@xercesc_2_8@@2QBDB)
2>XmlPersistingService.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl xercesc_2_8::XMLPlatformUtils::Terminate(void)" (__imp_?Terminate@XMLPlatformUtils@xercesc_2_8@@SAXXZ) referenced in function "public: __cdecl XmlPersistingService::~XmlPersistingService(void)" (??1XmlPersistingService@@QEAA@XZ)
2>XmlPersistingService.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class xercesc_2_8::DOMImplementation * __cdecl xercesc_2_8::DOMImplementationRegistry::getDOMImplementation(wchar_t const *)" (__imp_?getDOMImplementation@DOMImplementationRegistry@xercesc_2_8@@SAPEAVDOMImplementation@2@PEB_W@Z) referenced in function "public: void __cdecl XmlPersistingService::WriteToXml(class Bill const &)" (?WriteToXml@XmlPersistingService@@QEAAXAEBVBill@@@Z)
2>XmlPersistingService.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static wchar_t * __cdecl xercesc_2_8::XMLString::transcode(char const * const)" (__imp_?transcode@XMLString@xercesc_2_8@@SAPEA_WQEBD@Z) referenced in function "public: void __cdecl XmlPersistingService::WriteToXml(class Bill const &)" (?WriteToXml@XmlPersistingService@@QEAAXAEBVBill@@@Z)

I added the required libs (xerces-c_2_D.lib and the rest) in the input libs of the linker settings. I added the <xercesc>/lib directory, so the linker can find them. The famous "Treat wchar as data type" option is turned on.

I have a 64-bit machine, so I downloaded the xerces-c_2_8_0-x86_64-windows-vc_8_0.zip package on the Xerces-C++package.

Unfortunately, the linker errors are still there. Can you help me?

I found the solution for my problem. I forgot to add the Xerces libraries to one of my test projects of my Visual Studio studio. I also added the /bin directory of Xerces in the PATH environment variable to be able to use the .dlls.

I hope that this may help someone in the future.

commented: Nice - and good job :) +18

It is also important to define XML_LIBRARY in the preprocessor definitions of the app using Xerces, otherwise these errors occur.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.