UnsatisfiedLinkError (gxx and gcj) with JNI and C++ but not C

Andrew Richardson a.chardson@gmail.com
Sun Feb 27 18:09:00 GMT 2011


Good observation. I added '-l stdc++' to the ld call. I also had to add a symlink in /usr/lib (it only contained libstdc++.so.6 and libstdc++.so.6.14. I added libstdc++.so --> libstdc++.so.6)

Same error, though.


On Feb 27, 2011, at 12:15 PM, Jonathan Wakely wrote:

> On 27 February 2011 16:57, Andrew Richardson wrote:
>> 
>> Please note that I compile my source with:
>>         g++ -Wall -g -lstdc++ -shared -O2 -c -fPIC -D_REENTRANT filename.cpp -I/usr/lib/jvm/java-6-openjdk/include/
> 
> Specifying the linker option -lstdc++ doesn't do anything when compiling.
> 
>> and link with:
>>        ld --shared filename.o -o libfilename.so
> 
> You haven't used -lstdc++ during linking.
> 
> If you use g++ to link instead of ld then it should automatically add
> -lstdc++ anyway.



More information about the Gcc-help mailing list