M
mearvk
Hello,
Let me preface this post by saying I'm new to C/C++ and to gcc/g++.
Now then, I'm trying to get Xerces (C++) working on a (64-bit) redhat
machine. The Xerces binaries were part of the Redhat distribition, and
are under /usr/lib64/httpd/.../xerces/ (Apache's stuff right?). Below
is the (simple) source file I am trying to compile:
#include <xercesc/util/PlatformUtils.hpp>
#include <iostream>
XERCES_CPP_NAMESPACE_USE
int main(int argc, char* argv[])
{
try
{
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch)
{
// Do your failure processing here
return 1;
}
// Do your actual work with Xerces-C++ here.
std::cout << "Hello, world!\n";
//Terminate DDAS_XML_Parser
XMLPlatformUtils::Terminate();
// Other terminations and cleanup.
return 0;
}
The following command runs without error:
$ g++ -Wall -c DDAS_XML_Parser.C -L/usr/lib64/httpd/modules/xerces/
xerces-c-redhat_AS4-gcc_343/lib -I/usr/lib64/httpd/modules/xerces/
xerces-c-redhat_AS4-gcc_343/include
Now I get the following errors when I try to compile this program as
an executable:
$ g++ -Wall DDAS_XML_Parser.o -o DDAS_XML_Parser
DDAS_XML_Parser.o(.text+0x135): In function `main':
: undefined reference to `xercesc_2_7::XMLUni::fgXercescDefaultLocale'
DDAS_XML_Parser.o(.text+0x13a): In function `main':
: undefined reference to
`xercesc_2_7::XMLPlatformUtils::Initialize(char const*, char const*,
xercesc_2_7:anicHandler*, xercesc_2_7::MemoryManager*, bool)'
DDAS_XML_Parser.o(.text+0x17e): In function `main':
: undefined reference to `xercesc_2_7::XMLPlatformUtils::Terminate()'
DDAS_XML_Parser.o(.gcc_except_table+0x10): undefined reference to
`typeinfo for xercesc_2_7::XMLException'
collect2: ld returned 1 exit status
I have already defined the LD_LIBRARY_PATH to point to the location of
the ../lib folder which contains the .so files and the C_PLUS_INCLUDE
points to the ../include location. So the explicit command line
references are just making sure (in my mind) that g++ sees those
folders. But it's like the compiler doesn't see the .so files, even
though I think I'm telling it (twice) where it is.
Please let me know if I've left out any pertinent data needed for
diagnosis.
Help is greatly appreciated and thanks ahead of time,
Max
Let me preface this post by saying I'm new to C/C++ and to gcc/g++.
Now then, I'm trying to get Xerces (C++) working on a (64-bit) redhat
machine. The Xerces binaries were part of the Redhat distribition, and
are under /usr/lib64/httpd/.../xerces/ (Apache's stuff right?). Below
is the (simple) source file I am trying to compile:
#include <xercesc/util/PlatformUtils.hpp>
#include <iostream>
XERCES_CPP_NAMESPACE_USE
int main(int argc, char* argv[])
{
try
{
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch)
{
// Do your failure processing here
return 1;
}
// Do your actual work with Xerces-C++ here.
std::cout << "Hello, world!\n";
//Terminate DDAS_XML_Parser
XMLPlatformUtils::Terminate();
// Other terminations and cleanup.
return 0;
}
The following command runs without error:
$ g++ -Wall -c DDAS_XML_Parser.C -L/usr/lib64/httpd/modules/xerces/
xerces-c-redhat_AS4-gcc_343/lib -I/usr/lib64/httpd/modules/xerces/
xerces-c-redhat_AS4-gcc_343/include
Now I get the following errors when I try to compile this program as
an executable:
$ g++ -Wall DDAS_XML_Parser.o -o DDAS_XML_Parser
DDAS_XML_Parser.o(.text+0x135): In function `main':
: undefined reference to `xercesc_2_7::XMLUni::fgXercescDefaultLocale'
DDAS_XML_Parser.o(.text+0x13a): In function `main':
: undefined reference to
`xercesc_2_7::XMLPlatformUtils::Initialize(char const*, char const*,
xercesc_2_7:anicHandler*, xercesc_2_7::MemoryManager*, bool)'
DDAS_XML_Parser.o(.text+0x17e): In function `main':
: undefined reference to `xercesc_2_7::XMLPlatformUtils::Terminate()'
DDAS_XML_Parser.o(.gcc_except_table+0x10): undefined reference to
`typeinfo for xercesc_2_7::XMLException'
collect2: ld returned 1 exit status
I have already defined the LD_LIBRARY_PATH to point to the location of
the ../lib folder which contains the .so files and the C_PLUS_INCLUDE
points to the ../include location. So the explicit command line
references are just making sure (in my mind) that g++ sees those
folders. But it's like the compiler doesn't see the .so files, even
though I think I'm telling it (twice) where it is.
Please let me know if I've left out any pertinent data needed for
diagnosis.
Help is greatly appreciated and thanks ahead of time,
Max