[英]Calling Shared Libraries in Ubuntu
In Ubuntu 12.04.1 LTS I created a .so library file using this code: 在Ubuntu 12.04.1 LTS中,我使用以下代码创建了一个.so库文件:
g++ -c -Wall -Werror -fPIC someCode.cpp
g++ -shared -o libSomeCode.so someCode.o
I need to use that library file within an executable. 我需要在可执行文件中使用该库文件。 But when running the .exe it cannot find the .so file. 但是,运行.exe时,找不到.so文件。 So I have to copy the library to /usr/lib/. 因此,我必须将库复制到/ usr / lib /。 I tried using this command (without success): 我尝试使用此命令(未成功):
export LD_LIBRARY_PATH=/home/personalFolder/Desktop/codeFolder:$LD_LIBRARY_PATH
Is there a way to avoid copying the .so to /usr/lib/? 有没有办法避免将.so复制到/ usr / lib /?
Thanks in advance. 提前致谢。
添加“; \\”解决了我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.