1 Replies - 1545 Views - Last Post: 05 February 2011 - 04:42 AM Rate Topic: -----

#1 bitman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-February 11

Xerces c++ & NetBeans

Posted 05 February 2011 - 04:17 AM

Dear Anybody!

I try to parse some xml file by Xerces C++ 3.1.1 in NetBeans 6.9.1. (with MinGW) but the compiler can not build the project. The source pasted from the Xerces documentation. The Xerces bin path included to the enviroment path variable and the Xerces include path included to the source folders of the project.

Here is the code snippet:

#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/dom/DOM.hpp>

using namespace xercesc;

int main(int argc, char** argv)
{
    try
    {
        XMLPlatformUtils::Initialize();
        XMLCh name[101];
        XMLString::transcode( "test", name, 100 );
        DOMImplementation *imp = DOMImplementationRegistry::getDOMImplementation( name );
        XMLString::transcode( "root", name, 100 );
        XMLPlatformUtils::Terminate();
    }
    catch ( const XMLException &e )
    {
        return 1;
    }
    return 0;
}



Here I pasted the compiler output:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/e/zsolt/NetBeans/Test'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW_Qt-Windows/test.exe
make[2]: Entering directory `/e/zsolt/NetBeans/Test'
mkdir -p dist/Debug/MinGW_Qt-Windows
g++.exe     -o dist/Debug/MinGW_Qt-Windows/test build/Debug/MinGW_Qt-Windows/main.o  
build/Debug/MinGW_Qt-Windows/main.o: In function `main':
E:\zsolt\NetBeans\Test/main.cpp:24: undefined reference to `_imp___ZN11xercesc_3_16XMLUni22fgXercescDefaultLocaleE'
E:\zsolt\NetBeans\Test/main.cpp:24: undefined reference to `_imp___ZN11xercesc_3_116XMLPlatformUtils10InitializeEPKcS2_PNS_12PanicHandlerEPNS_13MemoryManagerE'
E:\zsolt\NetBeans\Test/main.cpp:26: undefined reference to `_imp___ZN11xercesc_3_116XMLPlatformUtils15fgMemoryManagerE'
E:\zsolt\NetBeans\Test/main.cpp:26: undefined reference to `_imp___ZN11xercesc_3_19XMLString9transcodeEPKcPtmPNS_13MemoryManagerE'
E:\zsolt\NetBeans\Test/main.cpp:27: undefined reference to `_imp___ZN11xercesc_3_125DOMImplementationRegistry20getDOMImplementationEPKt'
E:\zsolt\NetBeans\Test/main.cpp:28: undefined reference to `_imp___ZN11xercesc_3_116XMLPlatformUtils15fgMemoryManagerE'
E:\zsolt\NetBeans\Test/main.cpp:28: undefined reference to `_imp___ZN11xercesc_3_19XMLString9transcodeEPKcPtmPNS_13MemoryManagerE'
E:\zsolt\NetBeans\Test/main.cpp:32: undefined reference to `_imp___ZN11xercesc_3_116XMLPlatformUtils9TerminateEv'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW_Qt-Windows/test.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/e/zsolt/NetBeans/Test'
make[1]: Leaving directory `/e/zsolt/NetBeans/Test'

BUILD FAILED (exit value 2, total time: 1s)



Can anybody help me the settings of NetBeans to resolve the problems?

MOD EDIT: When posting code...USE CODE TAGS!!!

:code:

This post has been edited by JackOfAllTrades: 05 February 2011 - 04:39 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Xerces c++ & NetBeans

#2 JackOfAllTrades  Icon User is online

  • Saucy!
  • member icon

Reputation: 5959
  • View blog
  • Posts: 23,229
  • Joined: 23-August 08

Re: Xerces c++ & NetBeans

Posted 05 February 2011 - 04:42 AM

You need to add the Xerces library to the list of libraries to link. Not having NetBeans, I can't tell you how to do this, but it's probably under project options of some sort. You should add the path to the Xerces library to the lib search path and the library itself to the linked libraries list.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1