Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add library path in Eclipse CDT

📅 2013-Sep-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ eclipse cdt, library path ⬩ 📚 Archive

A C/C++ project may need to be linked with library files that are not placed in the standard library path locations. To indicate to the compiler to search these paths, you typically use the compiler option -L. For example, the option -L/usr/local/foobar makes the compiler search the directory /usr/local/foobar for library files to link with your program.

Similarly, to add a library path to the compilation of your project 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 > Library search path.

  3. Click the + button and add the library path. For example, add /usr/local/foobar. If you want to add multiple paths, add them separately like this.

Tried with: Eclipse 3.7.2, Eclipse CDT 8.0.2 and Ubuntu 12.04 LTS

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧