C++: Weird shared library error – eclipse-Collection of common programming errors

I had exactly the same error. I am using eclipse Juno with Cuda under Ubuntu 10.04. The problem was that while I wad already configured the linker path to point to /usr/local/cuda/lib64 (in ~/.bashrc etc), eclipse still couldn’t find it. I could run the compiled (via eclipse) project from terminal, but it couldn’t link in eclipse’s terminal after trying to Run.

My solution was to add the variable LD_LIBRARY_PATH with value /usr/local/cuda/lib64 in File->Properties->Run/Debug Settings->Edit (Selected project)->Environment Tab

I don’t know if there’s a more permanent solution but it worked for me. I should also mention that I had already added accordingly some extra variables in the Building Environment (C/C++ Build->Environment in the properties window) because I couldn’t build the project for the same reason.

The only weird thing is that at first it could run without problem and then when I reopened eclipse, this error appeared without me changing anything.