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 Crystal Martel <cm...@parasun.com> on 2005/01/17 23:19:19 UTC

using xerces c++ header files

Hello,

I've looked throughout your site, and searched through the email
messages archive for an answer to the following question...

The sys admin has installed xerces c++ parser on a linux (red hat)
platform.  I am trying to link to the libraries installed, but I'm
having problems.

I've tried to set my LD_LIBRARY_PATH to various paths including:
export LD_LIBRARY_PATH=/usr/src/xerces-c-src_2_6_0/lib:$LD_LIBRARY_PATH

However, the g++ compiler is not able to link to the .hpp files.

Any hints/tips?

Thanks,
Crystal


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: using xerces c++ header files

Posted by Crystal Martel <cm...@parasun.com>.
Hello,

Using:

g++ -I $XERCESROOT/include -L $XERCESROOT/lib -l xerces-c test.c

I am now able to compile test.c
Thanks for you help.  Sorry for wasting your time.

Crystal

On Tue, 2005-01-18 at 14:24 -0800, david_n_bertoni@us.ibm.com wrote:
> > Hi Joanne,
> > 
> > As per your suggestion, I've used the compiling command, along with
> > changing test.c (to remove include).  I'm getting the compiler errors
> > below.  It looks like maybe a library issue...
> > 
> > /tmp/ccSN4FhO.o(.text+0x17): In function `main':
> > : undefined reference to `xercesc_2_6::XMLUni::fgXercescDefaultLocale'
> > /tmp/ccSN4FhO.o(.text+0x1c): In function `main':
> > : undefined reference to `xercesc_2_6::XMLPlatformUtils::Initialize(char
> > const*, char const*, xercesc_2_6::PanicHandler*,
> > xercesc_2_6::MemoryManager*)'
> > /tmp/ccSN4FhO.o(.text+0x58): In function `main':
> > : undefined reference to `xercesc_2_6::XMLPlatformUtils::Terminate()'
> > /tmp/ccSN4FhO.o(.gcc_except_table+0x10): undefined reference to
> > `typeinfo for xercesc_2_6::XMLException'
> > collect2: ld returned 1 exit status
> 
> Those are not compiler errors -- they are linker errors.  The linker does 
> not need the header files, it needs the shared library that contains the 
> definitions of these functions.  Try adding the following the compilation 
> command:
> 
> -L /usr/src/xerces-c-src_2_6_0/lib -l xerces-c
> 
> I'm not convinced you understand what the various tools (compiler, linker, 
> etc.) do, and what resources they need to accomplish what they do.  In the 
> future, rather than post what you think the problem is, it would better if 
> you posted the actual error message(s) you get.  Otherwise, we will all 
> spend lots of time guessing what the problem is.
> 
> Dave
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: using xerces c++ header files

Posted by da...@us.ibm.com.
> Hi Joanne,
> 
> As per your suggestion, I've used the compiling command, along with
> changing test.c (to remove include).  I'm getting the compiler errors
> below.  It looks like maybe a library issue...
> 
> /tmp/ccSN4FhO.o(.text+0x17): In function `main':
> : undefined reference to `xercesc_2_6::XMLUni::fgXercescDefaultLocale'
> /tmp/ccSN4FhO.o(.text+0x1c): In function `main':
> : undefined reference to `xercesc_2_6::XMLPlatformUtils::Initialize(char
> const*, char const*, xercesc_2_6::PanicHandler*,
> xercesc_2_6::MemoryManager*)'
> /tmp/ccSN4FhO.o(.text+0x58): In function `main':
> : undefined reference to `xercesc_2_6::XMLPlatformUtils::Terminate()'
> /tmp/ccSN4FhO.o(.gcc_except_table+0x10): undefined reference to
> `typeinfo for xercesc_2_6::XMLException'
> collect2: ld returned 1 exit status

Those are not compiler errors -- they are linker errors.  The linker does 
not need the header files, it needs the shared library that contains the 
definitions of these functions.  Try adding the following the compilation 
command:

-L /usr/src/xerces-c-src_2_6_0/lib -l xerces-c

I'm not convinced you understand what the various tools (compiler, linker, 
etc.) do, and what resources they need to accomplish what they do.  In the 
future, rather than post what you think the problem is, it would better if 
you posted the actual error message(s) you get.  Otherwise, we will all 
spend lots of time guessing what the problem is.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: using xerces c++ header files

Posted by Crystal Martel <cm...@parasun.com>.
> I think you might need  
> 
> g++ -I $XERCESCROOT/include test.c
> 
> ..and you'll probably have to modify the #include statments in test.c 
> accordingly.
> 
> Joanne
> 


Hi Joanne,

As per your suggestion, I've used the compiling command, along with
changing test.c (to remove include).  I'm getting the compiler errors
below.  It looks like maybe a library issue...

/tmp/ccSN4FhO.o(.text+0x17): In function `main':
: undefined reference to `xercesc_2_6::XMLUni::fgXercescDefaultLocale'
/tmp/ccSN4FhO.o(.text+0x1c): In function `main':
: undefined reference to `xercesc_2_6::XMLPlatformUtils::Initialize(char
const*, char const*, xercesc_2_6::PanicHandler*,
xercesc_2_6::MemoryManager*)'
/tmp/ccSN4FhO.o(.text+0x58): In function `main':
: undefined reference to `xercesc_2_6::XMLPlatformUtils::Terminate()'
/tmp/ccSN4FhO.o(.gcc_except_table+0x10): undefined reference to
`typeinfo for xercesc_2_6::XMLException'
collect2: ld returned 1 exit status


The test.c is a very basic:

// Other include files, declarations, and non-Xerces-C++
// initializations.
#include <xercesc/util/PlatformUtils.hpp>

XERCES_CPP_NAMESPACE_USE

int main()
{

  try {
    XMLPlatformUtils::Initialize();
  }
  catch (const XMLException& toCatch) {
    // Do your failure processing here
    return 1;
  }

  // Do your actual work with Xerces-C++ here.

  XMLPlatformUtils::Terminate();

  // Other terminations and cleanup.
  return 0;
}




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: using xerces c++ header files

Posted by Joanne Bogart <jr...@slac.stanford.edu>.
Crystal Martel wrote:

>On Tue, 2005-01-18 at 21:25 +0100, Axel Weiß wrote:
>  
>
>>Am Montag, 17. Januar 2005 23:19 schrieb Crystal Martel:
>>    
>>
>>>Hello,
>>>
>>>I've looked throughout your site, and searched through the email
>>>messages archive for an answer to the following question...
>>>
>>>The sys admin has installed xerces c++ parser on a linux (red hat)
>>>platform.  I am trying to link to the libraries installed, but I'm
>>>having problems.
>>>
>>>I've tried to set my LD_LIBRARY_PATH to various paths including:
>>>export
>>>LD_LIBRARY_PATH=/usr/src/xerces-c-src_2_6_0/lib:$LD_LIBRARY_PATH
>>>
>>>However, the g++ compiler is not able to link to the .hpp files.
>>>      
>>>
>>Hi Crystal,
>>
>>LD_LIBRARY_PATH is for libraries (*.so), not for headers.
>>
>>Do you actually have problems finding .hpp files (e.g. complains the 
>>compiler about missing headers) - or does your linker miss libraries?
>>
>>Try to find the .hpp files in /usr/include or /usr/local/include (look 
>>for a directory 'xercesc') or ask your admin where you'll find them. 
>>Then add this path to your compiler's include-path (e.g. add the option 
>>-I/usr/local/include).
>>
>>It might be necessary to expand LD_LIBRARY_PATH, dependend where the libs 
>>have been installed.
>>
>>Hope this helps,
>>			Axel
>>
>>    
>>
>
>Hi Axel, 
>
>Thank you for the prompt response.  No, I don't actually have problems
>finding the .hpp files.  If I code an absolute path to a xerces header
>file, the linker is able to find the header, but that header includes
>others headers.  The compiler is unable to find these (even though
>they're in the same dir as original header).  (The linker tries to find
>them in the local directory - local to the C++ file I'm trying to
>compile).
>
>I compile using the options:
>g++ -I $XERCESROOT test.c
>
>where -I is the include path, and $XERCESROOT is /usr/src/xerces-c-
>src_2_6_0
>
>Compiling with the above options results in the same problem as above,
>where the linker finds the xerces header file I'm trying to include, but
>subsequent includes in *that* header file cannot be found (even though
>they are in the same directory).
>
>Thanks for your help,
>Crystal
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>  
>
I think you might need  

g++ -I $XERCESCROOT/include test.c

..and you'll probably have to modify the #include statments in test.c 
accordingly.

Joanne


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: using xerces c++ header files

Posted by Crystal Martel <cm...@parasun.com>.
On Tue, 2005-01-18 at 21:25 +0100, Axel Weiß wrote:
> Am Montag, 17. Januar 2005 23:19 schrieb Crystal Martel:
> > Hello,
> >
> > I've looked throughout your site, and searched through the email
> > messages archive for an answer to the following question...
> >
> > The sys admin has installed xerces c++ parser on a linux (red hat)
> > platform.  I am trying to link to the libraries installed, but I'm
> > having problems.
> >
> > I've tried to set my LD_LIBRARY_PATH to various paths including:
> > export
> > LD_LIBRARY_PATH=/usr/src/xerces-c-src_2_6_0/lib:$LD_LIBRARY_PATH
> >
> > However, the g++ compiler is not able to link to the .hpp files.
> 
> Hi Crystal,
> 
> LD_LIBRARY_PATH is for libraries (*.so), not for headers.
> 
> Do you actually have problems finding .hpp files (e.g. complains the 
> compiler about missing headers) - or does your linker miss libraries?
> 
> Try to find the .hpp files in /usr/include or /usr/local/include (look 
> for a directory 'xercesc') or ask your admin where you'll find them. 
> Then add this path to your compiler's include-path (e.g. add the option 
> -I/usr/local/include).
> 
> It might be necessary to expand LD_LIBRARY_PATH, dependend where the libs 
> have been installed.
> 
> Hope this helps,
> 			Axel
> 

Hi Axel, 

Thank you for the prompt response.  No, I don't actually have problems
finding the .hpp files.  If I code an absolute path to a xerces header
file, the linker is able to find the header, but that header includes
others headers.  The compiler is unable to find these (even though
they're in the same dir as original header).  (The linker tries to find
them in the local directory - local to the C++ file I'm trying to
compile).

I compile using the options:
g++ -I $XERCESROOT test.c

where -I is the include path, and $XERCESROOT is /usr/src/xerces-c-
src_2_6_0

Compiling with the above options results in the same problem as above,
where the linker finds the xerces header file I'm trying to include, but
subsequent includes in *that* header file cannot be found (even though
they are in the same directory).

Thanks for your help,
Crystal


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: using xerces c++ header files

Posted by Axel Weiß <aw...@informatik.hu-berlin.de>.
Am Montag, 17. Januar 2005 23:19 schrieb Crystal Martel:
> Hello,
>
> I've looked throughout your site, and searched through the email
> messages archive for an answer to the following question...
>
> The sys admin has installed xerces c++ parser on a linux (red hat)
> platform.  I am trying to link to the libraries installed, but I'm
> having problems.
>
> I've tried to set my LD_LIBRARY_PATH to various paths including:
> export
> LD_LIBRARY_PATH=/usr/src/xerces-c-src_2_6_0/lib:$LD_LIBRARY_PATH
>
> However, the g++ compiler is not able to link to the .hpp files.

Hi Crystal,

LD_LIBRARY_PATH is for libraries (*.so), not for headers.

Do you actually have problems finding .hpp files (e.g. complains the 
compiler about missing headers) - or does your linker miss libraries?

Try to find the .hpp files in /usr/include or /usr/local/include (look 
for a directory 'xercesc') or ask your admin where you'll find them. 
Then add this path to your compiler's include-path (e.g. add the option 
-I/usr/local/include).

It might be necessary to expand LD_LIBRARY_PATH, dependend where the libs 
have been installed.

Hope this helps,
			Axel

-- 
Humboldt-Universität zu Berlin
Institut für Informatik
Signalverarbeitung und Mustererkennung
Dipl.-Inf. Axel Weiß
Rudower Chaussee 25
12489 Berlin-Adlershof
+49-30-2093-3050
** www.freesp.de **

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org