Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add include directory in Eclipse CDT

📅 2013-Sep-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Many C/C++ projects may have to use header files that are not placed in the standard include directories. In some projects, the include files of the project itself are placed in one or more separate directories. For all such cases, you need to indicate Eclipse CDT to add these include directories to the compilation. Else your compilation fails with the error that an included header file cannot be found.

To add an include directory to your project in Eclipse CDT:

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

  2. For include directory used by C++ files, choose Cross G++ Compiler > Includes. For C files, choose Cross GCC Compiler > Includes.

  3. In the Include paths section, click the + button and add the include directory. If you want to add multiple include directories, add them separately like this.

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