You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Alvaro Moraleda <al...@gmail.com> on 2007/09/25 12:52:21 UTC
"undefined reference to xercesc_2_8"
Hi everybody!
I'm using xercesc_2_8_0 with Eclipse 3.2.2. (added the
"xerces-c-src_2_8_0/include/" path into the Project)
I can run the samples but when I try to run the following code,
-----------------------------------------
#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_USE
int main(int argc, char* argv[])
{
try {
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch) {
return 1;
}
XMLPlatformUtils::Terminate();
return 0;
}
----------------------------------------
I get this:
on "::Initialize()" line: "undefined reference to
'xercesc_2_8::fgXercescDefaultLocale'"
on "::Terminate()" line: "undefined reference to
'xercesc_2_8::XMLPlatformUtils::Terminate()'"
I tried to change it for this:
--------------------------------------------
#include <xercesc/util/PlatformUtils.hpp>
int main(int argc, char* argv[])
{
try {
xercesc::XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch) {
return 1;
}
xercesc::XMLPlatformUtils::Terminate();
return 0;
}
--------------------------------------------
but unfortunally, I get the next errors:
on "catch" line: "ISO C++ forbids declaration of 'XMLException' with no type"
Thank you for your help.
Best regards.
Re: "undefined reference to xercesc_2_8"
Posted by Alvaro Moraleda <al...@gmail.com>.
Hi ,
I'm sorry, I added the environment variables (XERCESCROOT, XERCESCOUT,
LD_LIBRARY_PATH ) in the wrong place. I thought that these variables
had to be in the properties from the Project, but finally I understood
that these ones have to be in the Run Configurations environment.
Thank you all.
> Axel wrote:
> > did you also add the xerces libraries for linking? The error messages
> > you get come from the linker.
>
> Hallo Axel!
> do you mean the "xerces-c-src_2_8_8/lib/" ?
> I tried to add it as "Library search path (-L)", but I need to specify
> which library (-l). I tried many variations ("libxerces-c.so",
> "xerces-c.so"), and finally adding "xerces-c" and I get:
> "error while loading shared libraries: libxerces-c.so.28: cannot open
> shared object file: No such file or directory"
>
> Thank you. ;)
>
> MfG
>
Re: "undefined reference to xercesc_2_8"
Posted by Alvaro Moraleda <al...@gmail.com>.
Axel wrote:
> did you also add the xerces libraries for linking? The error messages
> you get come from the linker.
Hallo Axel!
do you mean the "xerces-c-src_2_8_8/lib/" ?
I tried to add it as "Library search path (-L)", but I need to specify
which library (-l). I tried many variations ("libxerces-c.so",
"xerces-c.so"), and finally adding "xerces-c" and I get:
"error while loading shared libraries: libxerces-c.so.28: cannot open
shared object file: No such file or directory"
Thank you. ;)
MfG
Re: "undefined reference to xercesc_2_8"
Posted by Axel Weiss <aw...@informatik.hu-berlin.de>.
On Tue, 2007-09-25 at 12:52 +0200, Alvaro Moraleda wrote:
> Hi everybody!
> I'm using xercesc_2_8_0 with Eclipse 3.2.2. (added the
> "xerces-c-src_2_8_0/include/" path into the Project)
Hi Alvaro,
did you also add the xerces libraries for linking? The error messages
you get come from the linker.
> I tried to change it for this:
>
> --------------------------------------------
> #include <xercesc/util/PlatformUtils.hpp>
>
> int main(int argc, char* argv[])
> {
> try {
> xercesc::XMLPlatformUtils::Initialize();
> }
> catch (const XMLException& toCatch) {
Try using xercesc::XMLPlatformUtils::XMLException& here. But this would
only bring you to the situation above. You don't see the linker errors
here since the compiler hits a syntax error before.
HTH,
Axel