📅 2013-Sep-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ eclipse, eclipse cdt, library, shared library ⬩ 📚 Archive
The source code of a C/C++ project may need to be linked with an external shared library file. When compiling from the commandline, this is typically linked using the compiler option
-l. For example, to link with a library file named
libfoobar.so, which is placed in one of the standard library paths, you use the option
-lfoobar. As you can see, the
lib prefix and the file extension
.so do not need to be specified.
Similarly, to add a library file to be linked in Eclipse CDT:
Right-click on the project name in Project Explorer, choose Properties > C/C++ Build > Settings > Tool Settings
Go to Cross G++ Linker > Libraries > Libraries.
Click the + button and add the name of the library file, omit the file extension. For example, to add the library file
libfoobar.so, just add
foobar. To add multiple library files, add them separately like this.
Tried with: Eclipse 3.7.2, Eclipse CDT 8.0.2 and Ubuntu 12.04 LTS