To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1392
1391  |  1393
Subject: 
Re: Statically and Dynamically linking lnp ....
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sat, 26 Aug 2000 14:31:44 GMT
Viewed: 
1141 times
  
Regarding the previous posting: Please disregard ...

I figured it out, but thought it may be useful to post
a reply to myself, in case it's ever of use to anyone
else using the same tools:

I forgot to wrap my include in an ' extern "C" ' block.
As I understand it this prevents C++ name mangling from
obscuring calls to pure C comnpiled code ???

Anyway the simple code

extern "C"{
#include "liblnp.h"
}

in my C++ class header file seems to have fixed it for now ;-)

Cheers,

Colin



In lugnet.robotics.rcx.legos, Colin Ryan writes:
Hi All,

I was wondering if someone could give me a quick guide
as to the compilation/linking options when using
liblnp.h etc. I'm having a few difficulties.

I wanted to know how exactly to link in the shared library.
I tried installing it in the standard /lib and running
ldconfig (as root) on that dir to recognise it, I also tried
pointing to the directory containing it using the
$LD_LIBRARY_PATH env variable, but neither have worked:

I have referenced the liblnp.h in a c++ source file (which
I'm using to wrap LNP functionality) and then compiled it
sucessfully, but when I try to link it to my main() class,
in my make environment, I get:

simpleLNPTransport.o: In function
`simpleLNPTransport::simpleLNPTransport(void)':
simpleLNPTransport.o(.text+0x81): undefined reference to `lnp_init(char *,
unsigned short, unsigned char, unsigned char, int)'
simpleLNPTransport.o: In function `simpleLNPTransport::sendCORBA(unsigned char
const *&, unsigned char)':
simpleLNPTransport.o(.text+0x101): undefined reference to
`lnp_addressing_write(unsigned char const *, unsigned char, unsigned char,
unsigned char)'
simpleLNPTransport.o: In function `simpleLNPTransport::sendControl(unsigned
char const *&, unsigned char)':
simpleLNPTransport.o(.text+0x176): undefined reference to
`lnp_addressing_write(unsigned char const *, unsigned char, unsigned char,
unsigned char)'
collect2: ld returned 1 exit status
make: *** [nanOrbServer] Error 1

simpleLNPTransport is my cpp class file.


Thanks in advance,

Colin Ryan



Message has 1 Reply:
  Re: Statically and Dynamically linking lnp ....
 
(...) Colin, The "standard" for doing this is to wrap the extern "C" { and } in #ifdef __cplusplus clauses. You can see how to do this in most .h files in the include directory. Especially if it's a .h that may be used in mixed (C/C++) projects. (...) (24 years ago, 27-Aug-00, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Statically and Dynamically linking lnp ....
 
Hi All, I was wondering if someone could give me a quick guide as to the compilation/linking options when using liblnp.h etc. I'm having a few difficulties. I wanted to know how exactly to link in the shared library. I tried installing it in the (...) (24 years ago, 26-Aug-00, to lugnet.robotics.rcx.legos)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR