|Linking to Libraries [message #847674]
||Tue, 17 April 2012 10:48
| Andrew .
Registered: April 2012
I'm a bit newer to using Eclipse under Linux (Kubuntu 11.10) and i'm having a problem linking to libraries. I downloaded SFML Library ( www.sfml-dev.org ) unzipped it into my project folder and then went to configure Eclipse CDT to see everything it needs. I went to the C++ precompiler and showed it where the includes were and that seems fine, but when I showed it where the libraries are and told it to use the sfml-system library it can't find it. I had to install (with the apt package management in Kubuntu) the SFML files to the systems library folders. Then the compiler's linker could see them and it worked fine. I'm confused as to why after adding the path to the library that the compiler is ignorant to where they are?
|Re: Linking to Libraries [message #850650 is a reply to message #849966]
||Fri, 20 April 2012 03:50
| Axel Mueller
Registered: July 2009
Chris Miami wrote on Thu, 19 April 2012 18:19|
I am having a similar issue and this FAQ entry has 3 orthogonal suggestions for how to do it, leading the new user (me) to believe that no one really knows the real answer (none of the methods seemed to work).
There is another confusion, as there are two entirely different prefs panes (C/C++ Build/Settings and C/C++ General/Paths and Symbols) that seem to do the same thing, and no direction on why/when to use one or the other.
These are setting for the compiler.
- open Project Properties->C/C++ Build/Settings
- hit the "Libraries" item under "GCC C++ Linker"
- in the upper pane click the + symbol and enter name of your library; omit lib prefix and trailing .dll or .so; e.g. if your library is named libfoo.so you will enter foo
BTW, if your lib is called libfoo.so.1.0 you must create a symlink called libfoo.so that links to this file. The linker neeeds always libfoo.so (w/o version number) but for runtime libfoo.so.1.0 is needed!
- in the lower pane you can enter the path to the library (only necessary if your library is not in the system path, i.e. /usr/lib)
C/C++ General/Paths and Symbols:
Here you can define things for the Eclipse indexer if it was not able to automatically discover everything you need. The indexer is needed for code completion etc. This has *nothing* todo with the compiler settings!
If you are successful with the above steps you can adapt the instructions on the wiki page http://wiki.eclipse.org/CDT/User/FAQ#How_do_I_add_an_external_library_to_my_C.2B.2B_project.3F
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
Powered by FUDForum
. Page generated in 0.01564 seconds