You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Suryanarayanan, Priya" <Pr...@geometricglobal.com> on 2012/03/17 14:32:12 UTC

Build Error: Undefined reference to 'xercesc_3_1" (Eclipse helios and MinGW)

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


RE: Build Error: Undefined reference to 'xercesc_3_1" (Eclipse helios and MinGW)

Posted by "Suryanarayanan, Priya" <Pr...@geometricglobal.com>.
Hi,

I changed the namespace to

using namespace xercesc_3_1;

still no change in error.

Please help.

Thanks,
Priya

From: manish kumar burnwal [mailto:manishburnwal25@gmail.com]
Sent: Saturday, March 17, 2012 10:23 PM
To: c-dev@xerces.apache.org
Subject: Re: Build Error: Undefined reference to 'xercesc_3_1" (Eclipse helios and MinGW)

Hi,

I think there is some problem with the namespace,please see that you are writing the correct namespace, i think there is something more in the namespace xercesc*****,please check.
On Sat, Mar 17, 2012 at 7:02 PM, Suryanarayanan, Priya <Pr...@geometricglobal.com>> wrote:
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 link with the xerces-c_3.dll.

The Code:

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

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->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




--
Manish Kumar

Re: Build Error: Undefined reference to 'xercesc_3_1" (Eclipse helios and MinGW)

Posted by manish kumar burnwal <ma...@gmail.com>.
Hi,

I think there is some problem with the namespace,please see that you are
writing the correct namespace, i think there is something more in the
namespace xercesc*****,please check.

On Sat, Mar 17, 2012 at 7:02 PM, Suryanarayanan, Priya <
Priya.Suryanarayanan@geometricglobal.com> wrote:

>  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****
>
> ** **
>



-- 
Manish Kumar