开发者

Eclipse CDT Auto Include Shared Libraries

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

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.

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:

"error while loading shared libraries: libA.so: cannot open shared object file: No such file or directory"

I hav开发者_运维百科e tried moving A.so B.so and C into the same folder and run C but I get the same error.

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?


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.


You just need to set LD_LIBRARY_PATH to include the folder in which the shared libraries are. Something like this: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/lib/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜