• 6152阅读
  • 8回复

QT工程中加入.so文件 [复制链接]

上一主题 下一主题
离线daier1420
 

只看楼主 倒序阅读 楼主  发表于: 2009-11-11
我在linux下写好了串口程序,生成了。so的文件

我在我的工程中pro文件中加了LIBS +=-L/serial/bin -lserial

但是编译时还是报错说没有serial这个库。

各位,网上和书上都是这么做的,但是我这就是不对

希望有你的指点
离线20044454
只看该作者 1楼 发表于: 2009-11-11
copy **.so to /usr/lib/
[ 此帖被20044454在2009-11-11 15:50重新编辑 ]
让我做一个Qt的大牛!!!!
离线daier1420

只看该作者 2楼 发表于: 2009-11-11
侠客

是把。so文件拷到linux的usr/bin下??

可以解释哈不??
离线20044454
只看该作者 3楼 发表于: 2009-11-11
Sorry copy **.so to /usr/lib .you try it, I don't know the reason
让我做一个Qt的大牛!!!!
离线rqzrqh

只看该作者 4楼 发表于: 2009-11-11
bin下有这个库?
离线20044454
只看该作者 5楼 发表于: 2009-11-11
I'm sorry
copy *so to /usr/lib/
让我做一个Qt的大牛!!!!
离线daier1420

只看该作者 6楼 发表于: 2009-11-11
我试了。但是还是不行哈,编译时还是说没有这个库
离线steinlee

只看该作者 7楼 发表于: 2009-11-12
You may need to add the full path to LIBS +=-L/home/yourname/serial/bin -lserial
or
Open your Makefile in an editor
copy so file to /serial/bin
then add -L/home/yourname/serial/bin -lserial to LIBS =

if you do not know what the full path is, go to /serial/bin and type pwd to get the full path.

-L/serial/bin tells where your so is
-lserial means link it.

Normally you put a .so file in a lib, not in bin(for binary executable) since it is a dynamic library

我在linux下写好了串口程序,生成了。so的文件

我在我的工程中pro文件中加了LIBS +=-L/serial/bin -lserial

但是编译时还是报错说没有serial这个库。

各位,网上和书上都是这么做的,但是我这就是不对

希望有你的指点
[ 此帖被steinlee在2009-11-12 10:09重新编辑 ]
Looking for remote C/C++ and Qt 兼职
离线steinlee

只看该作者 8楼 发表于: 2009-11-12
You do not need to do this although it may work.
The reason why it works is that by default the environment variable LD_LIBRARY_PATH includes /usr/lib
If you copy so file there, path has been set already.
Type env to see if LD_LIBRARY_PATH has /usr/lib

引用第3楼20044454于2009-11-11 15:40发表的  :
Sorry copy **.so to /usr/lib .you try it, I don't know the reason
Looking for remote C/C++ and Qt 兼职
快速回复
限100 字节
 
上一个 下一个