Compiler gcc
Claudio Bley
bley@cs.uni-magdeburg.de
Tue Jul 23 13:19:00 GMT 2002
>>>>> "Mathias" == Mathias Bordier <mathias_bordier@yahoo.fr> writes:
Mathias> Hello, I want to create a dynamic library with the
Mathias> compiler gcc.2.7.2.3 on Sun-Solaris.2.5 for C++ code. I
Mathias> use JNI (Java Native Interface) for interfacing Java and
Mathias> C++. I compile and I link for creating a dynamic library
Mathias> (it's OK) and when I want to use this library, I see the
Mathias> message:
Mathias> ld.so.1: fatal: relocation error: file mylib.so: symbol
Mathias> __builtin_new: refrenced symbol not found
Mathias> I understand that the dynamic library I have created is
Mathias> not good !
Mathias> Maybe I have made an error when I compile or link my
Mathias> program C++:
Mathias> I have write: for compiling: g++ -I ... -c mylib.cc
Try with -fPIC in order to produce position independent code.
Mathias> for linking: g++ -shared -o mylib.so mylib.o -lstc++
Mathias> -lg++
I think you don't need to specify stdc++ (it's a typo in your command
isn't it?) and g++ library in this step - it doesn't hurt though.
HTH
Claudio
More information about the Gcc-help
mailing list