Eclipse CDT自动包括共享库 [英] Eclipse CDT Auto Include Shared Libraries

查看:161
本文介绍了Eclipse CDT自动包括共享库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中工作:Helios Service Release 1使用Eclipse CDT编译使用g ++

I am working in Eclipse: Helios Service Release 1 using Eclipse CDT compiling using g++

我刚刚开始在我的项目中使用共享库,已经遇到了一个小问题。我有三个项目A,B和C.A和B都是共享库,C是一个可执行文件。

I have just started to have a go at using Shared Libraries in my projects but have run into a little problem. I have three projects A, B and C. A and B are both Shared Libraries and C is an executable.

在eclipse下,我设法引用了A和B和C编译并正确运行但是当我尝试和手动运行生成的C程序在Eclipse外面我得到以下错误:

Under eclipse I have managed to reference A and B from C and C compiles and runs correctly but when I try and run the generated C program manually outside of Eclipse I get the following error:

加载共享库时出现错误:libA.so:无法打开共享对象文件:无此类文件或目录

我已经尝试将A.so B.so和C移动到同一个文件夹,运行C但我得到相同的错误。

I have tried moving A.so B.so and C into the same folder and run C but I get the same error.

我可以让Eclipse构建我的项目,所有的文件在同一个地方,他们仍然运行时,我把它们移动到一个新的位置?

Can I get Eclipse to build my project with all the files in the same place and them still run when I move them to a new location?

推荐答案

以root身份运行 ldconfig 更新缓存 - 如果仍然无法帮助,需要添加文件的路径 ld.so.conf (只是在它自己的行上键入它)或更好的是,添加条目到一个新的文件(更容易删除)目录 ld.so.conf.d

Run ldconfig as root to update the cache - if that still doesn't help, you need to add the path to the file ld.so.conf (just type it in on its own line) or better yet, add the entry to a new file (easier to delete) in directory ld.so.conf.d.

这篇关于Eclipse CDT自动包括共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆