[SLL] linking - calling C++ code from Java using SWIG

ter et at ihear.com
Fri Nov 7 10:49:40 PST 2008


On Fri, 2008-11-07 at 09:17 -0800, Mathew D. Watson wrote:
...
> java: symbol lookup error: undefined symbol: _Z8VVGCamera4open...
> 
> The symbol name was real long, and I saw it when I ran nm on the library 
> file. The library was created using
> 
> $ ld -r a.o b.o -o lib_ab.a
> $ g++ -shared c.o -o lib_abc.so -L. -l_ab
> 
> I managed to eliminate the error by creating the .so using
> 
> $ g++ -shared a.o b.o c.o -o lib_abc.so
> 
> Can someone explain why the symbol was missing from the first library 
> and not from the second one? In particular, why did I get the error when 
> nm showed that the symbol was present?
> 
> How can I modify the first g++ line so it correctly links against the 
> static library lib_ab.a?
Try

$ g++ -shared c.o -o lib_abc.so -L. -Wl,-Bstatic -l_ab




More information about the linux-list mailing list