ktizzel
ktizzel

Reputation: 43

Attempt to include header file in Xcode 5. File not found

I am trying to include a header file in my xcode 5 project. The file path is /Users/ceid/Desktop/test.h

#include "/User/ceid/Desktop/test.h" works

When I attempt to use #include "test.h" and put /Users/ceid/Desktop in my header search paths, the file is not found.

I have also tried User Search Paths. I have also tried both quotes and angle brackets.

Upvotes: 0

Views: 816

Answers (1)

NetVipeC
NetVipeC

Reputation: 4432

In C++ there are two general ways of include files.

#include "file": include the file searching in the same directory of the file containing the line. Some compiler and IDE, when not find the file fallback to the second option (ex: VC++)
#include <file>: include the file searching in the includes path added (-I option in GCC).

The recommended use is, #include "file", for files in the same context (same library, same module etc...), use #include <file> for external files (external in the sense of context, not in the sense of code not yours, example:

two libraries, crypto and datetime, if you want to include datetime in crypto use #include <file>, even if the two libreries are yours, and siting next to each other in disk, because tomorrow probably want to reorganize the libraries, grouped better, etc...

Upvotes: 1

Related Questions