Hi,

I'm trying to write some code to use Xerces C++ XML parser source, I have 
downloaded 3.1.1 binaries for Windows and I am trying to set up the project to 
statically link with the xerces-c_3.dll.

The Code:

#include <xercesc/util/PlatformUtils.hpp>
using namespace xercesc;

int main(int argc, char* argv[])
{
  try {
    XMLPlatformUtils::Initialize();
  }
  catch (const XMLException& toCatch) {
    // bad init
    return 1;
  }
  XMLPlatformUtils::Terminate();
  return 0;
}


However I get the below error message on build.

**** Build of configuration Release_DBG for project JTParserListener ****

**** Internal Builder is used for build               ****
g++ 
-LD:\priya\JT28Feb\rev1\workspace\JTParserListener\Externals\xerces-c-3.1.1\lib 
-LD:\priya\JT28Feb\rev1\workspace\JTParser\Release_DBG -p -pg 
-oJTParserListener.exe src\ProductInfo.o src\PLMXMLWriter.o 
src\JTParserListener.o -lxerces-c_3 -lJTParser
src\JTParserListener.o: In function `main':
D:\priya\JT28Feb\rev1\workspace\JTParserListener\Release_DBG/../src/JTParserListener.cpp:272:
 undefined reference to `xercesc_3_1::XMLUni::fgXercescDefaultLocale'
D:\priya\JT28Feb\rev1\workspace\JTParserListener\Release_DBG/../src/JTParserListener.cpp:272:
 undefined reference to `xercesc_3_1::XMLPlatformUtils::Initialize(char const*, 
char const*, xercesc_3_1::PanicHandler*, xercesc_3_1::MemoryManager*)'
D:\priya\JT28Feb\rev1\workspace\JTParserListener\Release_DBG/../src/JTParserListener.cpp:282:
 undefined reference to `xercesc_3_1::XMLPlatformUtils::Terminate()'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 313  ms.

I am Using Eclipse Helios IDE and  Mingw c++ compiler.

1 ) I downloaded the xerces binaries.
2) Included the lib and include folder in my project in "Externals/ 
xerces-c-3.1.1/" folder and added the xcerces dll in the Release_DBG folder.
3) I have set the project properties
 C++ Build->Settings-> GCC C++ Compiler->Preprocessor(-D) to 
XERCES_STATIC_LIBRARY
                                                                                
 ->Includes(-I) to 
"${workspace_loc:/${ProjName}/Externals/xerces-c-3.1.1/include}"
                                        ->MinGw C++ Linker->Libraries(-l) to 
xerces-c_3
                                                                                
 ->Library search path (-L) to 
"${workspace_loc:/JTParserListener/Externals/xerces-c-3.1.1/lib}"

Does anybody have any idea what am I missing here? The libraries are installed 
and the #include directives are processed (found) without a problem.

Would appreciate any help.

Thanks & Regards,
~Priya S

Reply via email to