Code Yarns β€πŸ‘¨β€πŸ’»
Tech Blog ❖ Personal Blog

How to add library in Eclipse CDT

πŸ“… 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:

  1. Right-click on the project name in Project Explorer, choose Properties > C/C++ Build > Settings > Tool Settings

  2. Go to Cross G++ Linker > Libraries > Libraries.

  3. 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


Β© 2023 Ashwin Nanjappa β€’ All writing under CC BY-SA license β€’ 🐘 Mastodon β€’ πŸ“§ Email