views:

28

answers:

1

I pulled out an application that I wrote in C++ using the sfml library, but I'm having trouble setting up the library in Eclipse. I specified the include path, the lib path and included all the necessary .so libraries to link to. the application compiles fine but it complains at runtime about missing libraries. Why is this happening? Didn't I include the path to the libraries in the project settings already? I have even tried to place all the .so's in the executable directory with no luck.

A: 

There is only the name of the shared lib stored in the executable. At program startup the dynamic linker then searches for the specified libs in its search paths. You can add/specify search paths by placing them colon separated in the environment variable LD_LIBRARY_PATH or by specifying them in /etc/ld.so.conf (at least if you use some unix based OS). On windows the whole PATH environment variable is used when searching for dynamic-link libraries (DLL).

To see the paths of shared libraries used by a given application run ldd applicationPath.

Elrohir
so I ran that command and it says the libraries that I’m trying to link to are in /usr/local/lib. Why is this? there are no options in my eclipse project settings with that path defined. How can I make it look for the shared libs in the project folder?
TheFuzz
maybe you have to start it like this (supposed the appname is appname): LD_LIBRARY_PATH=. ./appname
Elrohir