LD_LIBRARY_PATH在编译时无效
我的LD_LIBRARY_PATH设置是对了,而且在运行时能找到其中的so.
但在编译新新版本时报错:/usr/bin/ld: cannot find -lwfc
解析之后的命令是这样的:g++ -shared -Wl,-soname,libua_manager.so.1 -o ./libua_manager.so.1 -lwfc ua_manager.o ua_managerdll.o XmlParse.o
请问是什么原因啊?
[解决办法]
LD_LIBRARY_PATH是在运行的时候用的,编译的时候用-L
$LD_LIBRARY_PATH
On many Unix systems with a dynamic linker, contains a colon-separated list of directories that the dynamic linker should search for shared objects when building a process image after exec, before searching in any other directories.
http://en.wikipedia.org/wiki/Environment_variable
[解决办法]
楼主可以看看LD_LIBRARY_PATH的有关知识
http://wiki.services.openoffice.org/wiki/LD_LIBRARY_PATH
http://wiki.debian.org/RpathIssue
[解决办法]
要带上-L 参数。
[解决办法]
1楼就说过了,非到 7楼才看到。。
-lwfc 会在标准的 library 目录进行搜索 libwfc.so。额外位置的 .so 需要通过 -L 指定所在目录。