Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15357615
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2010-04-09 17:16:34

开发时设置LIBRARY_PATH动态链接库,以便gcc能够找到,
release时设置LD_LIBRARY_PATH以便程序加载时能够自动找到

gcc -L 自定义 lib路径

vim /etc/profile或者vim /etc/bashrc追家如下一行
export LIBRARY_PATH=/usr/local/lib/gliethttp_lib1:/usr/local/lib/gliethttp_lib2:$LIBRARY_PATH
加入上面一行保证gcc时能够找到库,等效于gcc -L/usr/local/lib/gliethttp_lib1 -L/usr/local/lib/gliethttp_lib2
阅读(5310) | 评论(3) | 转发(0) |
给主人留下些什么吧!~~

2011-05-22 15:31:21

学习了,多谢楼主分享哦!也欢迎广大linux爱好者来我的论坛一起讨论arm哦!www.lt-net.cn

chinaunix网友2010-06-19 09:17:50

我测试过了,在编译时设置LD_LIBRARY_PATH没有用的,该值只是在运行时有效。 zcx@zcx-laptop:~/study/dllstudy/test2$ export LD_LIBRARY_PATH=`pwd` zcx@zcx-laptop:~/study/dllstudy/test2$ echo $LD_LIBRARY_PATH /home/zcx/study/dllstudy/test2 zcx@zcx-laptop:~/study/dllstudy/test2$ gcc -o test test.c -ltest /usr/bin/ld: cannot find -ltest collect2: ld returned 1 exit status zcx@zcx-laptop:~/study/dllstudy/test2$ gcc -o test test.c -L. -ltest zcx@zcx-laptop:~/study/dllstudy/test2$ ./test