开发者

error /usr/bin/ld: cannot find -lmylibrary

hi I have this error in both eclipse and netbeans, I have mydynamiclib.so file when i add it to eclipse or netbeans and try to build i get the this error netbeans:

collect2: ld returned开发者_如何学Go 1 exit status

make[2]: * [dist/Debug/GNU-Linux-x86/myapp] Error 1

/usr/bin/ld: cannot find -lmydynamiclib

I'm using most recent versions of (ubuntu 10.10 ,netbeans, eclipse)


You need the libmydynamiclib.a file as well as the .so file and you should tell ld or gcc where to find it too.

e.g. gcc -o myapp -L/path/to/lib -lmydynamiclib

where libmydynamiclib.so lives in /path/to/lib.

Otherwise, don't link the library, but use dlopen() to load it dynamically. See the dlopen() manpage.


The linker can't find your shared library in it's search path. If you add the directory where your shared lib is to the LD_LIBRARY_PATH environment variable the linker should find it and be able to link against it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜