Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Header file not found in Eclipse CDT

I'm trying to build a project that uses an external library (Casablanca) using Eclipse CDT 8.8.1. on Mac OS. As expected, the first build run returned "cpprest/http_client.h file not found" errors.

I then proceeded to add an include path (/Users/me/projects/casablanca/Release/include) by right-clicking on the project, selecting Properties->C/C++ Include Paths and Symbols, Add External Include Path, and moving it up in priority as the first listed folder.

However this did not solve the problem and Eclipse still can't seem to find the headers. The #include directive is as below:

#include <cpprest/http_client.h>

and the added /include directory does have a /cpprest sub-directory, with http_client.h in it.

Any help would be appreciated.

like image 808
Nailbite Avatar asked Jun 21 '16 04:06

Nailbite


People also ask

HOW include header file in C Eclipse?

Select C/C++ General -> Path and Symbols. Select Includes tab. In Languages list, select 'GNU C' or whatever C compiler tool chain you use. Press 'Add...' button and add the directory for the include files.

Can we Run C code in Eclipse?

Eclipse is popular for Java project development. It also supports C/C++, PHP, Python, Perl, and other web project developments via extensible plug-ins. Eclipse is cross-platform and runs under Windows, Linux and Mac OS.

How to Run C C++ program in Eclipse?

Right-click the project and select Build Project. Finally, right-click the project and select run as and then Local C/C++ application. This should run your application.

Where can I find C header files?

Most standard headers are stored in /usr/include . It looks like stdbool. h is stored somewhere else, and depends on which compiler you are using. For example, g++ stores it in /usr/include/c++/4.7.


1 Answers

Adding an include path to Project Properties | C/C++ General | Paths and Symbols only adds the include path to the set of includes searched by CDT's indexer when indexing the project.

The actual build system needs to be told the include path by another means. If you're using a Managed Build project (as opposed to a Makefile project) - which it sounds like you are - you would add the include path in Project Properties | C/C++ Build | Settings. Note that the indexer automatically picks up build settings, so once you do this, there shouldn't be a need to also add it to Paths and Symbols.

like image 113
HighCommander4 Avatar answered Oct 09 '22 04:10

HighCommander4