Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Trying to learn Eclipse C++ with CDT(Including dynamic libraries in project)
Trying to learn Eclipse C++ with CDT [message #732349] Tue, 04 October 2011 14:57 Go to next message
Josiah  is currently offline Josiah Friend
Messages: 7
Registered: October 2011
Junior Member
I'm trying to learn Eclipse CDT development. To do this, I'm developing a fairly large application, and the first part of it I'm implementing is a low-level C++ dynamic library (lib___.so).

I created a project in another workspace to test the library. I did this to ensure I'd learn how to include the dynamic library in the other pieces of my project as I'm developing it so that there are less surprises down the road.

To include the library, I went into the GCC C++ Linker options of the project and added the -L path to the library my library resides in and the -l library name (minus the lib prefix and .so suffix).

I also copied the header file for the library's interface into my tester project's workspace and #include it in my test project.

When I build, everything builds fine for the test project. The issue I'm having is that when I try to run or debug, the linker cannot find my .so dynamic library file.

Any ideas? (I'm using Eclipse Indigo 3.7.1)
Re: Trying to learn Eclipse C++ with CDT [message #733579 is a reply to message #732349] Wed, 05 October 2011 06:36 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
There are three options.
1) extend the environment variable LD_LIBRARY_PATH so that it contains the path to your shared lib
2) put the shared lib in /usr/lib or /usr/local/lib and run ldconfig to update the lib database of your system (only root can do this)
3) use rpath as linker option to embed it the library path into your executable (see http://www.eyrie.org/~eagle/notes/rpath.html )


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Trying to learn Eclipse C++ with CDT [message #733902 is a reply to message #733579] Wed, 05 October 2011 22:08 Go to previous messageGo to next message
Josiah  is currently offline Josiah Friend
Messages: 7
Registered: October 2011
Junior Member
Thanks, Axel. I ended up extending the LD_LIBRARY_PATH variable and everything works fine now.

For future readers of this post, to extend the LD_LIBRARY_PATH permanently, which I had a little trouble figuring out, I had to create a config file and then run ldconfig, and restart the machine.
Re: Trying to learn Eclipse C++ with CDT [message #733965 is a reply to message #733902] Thu, 06 October 2011 07:08 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Josiah wrote on Thu, 06 October 2011 00:08
Thanks, Axel. I ended up extending the LD_LIBRARY_PATH variable and everything works fine now.

For future readers of this post, to extend the LD_LIBRARY_PATH permanently, which I had a little trouble figuring out, I had to create a config file and then run ldconfig, and restart the machine.

You can change the LD_LIBRARY_PATH variable in Debug Launch Configuration of your application in Eclipse.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Trying to learn Eclipse C++ with CDT [message #734079 is a reply to message #733965] Thu, 06 October 2011 15:45 Go to previous message
Josiah  is currently offline Josiah Friend
Messages: 7
Registered: October 2011
Junior Member
Thansk for the pointer. I'll take a look at that way of doing it.
Previous Topic:How can I specify an environment variable for Discovery Invocation
Next Topic:Trouble accessing interfaces of my include files
Goto Forum:
  


Current Time: Fri Sep 20 05:29:46 GMT 2024

Powered by FUDForum. Page generated in 0.04218 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top