Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode cannot find #Include<> header

I'm trying to get Xcode to import the header file for Irrlicht.

#include <irrlicht.h>

It says "Irrlicht.h. No such file or directory". Yes Irrlicht.h with a capital I, even though the #include is lowercase.

Anyway I added "/lib/irrlicht-1.6/include" in the header search paths for the Xcode project, yet it still doesn't find it.

The only thing I've tried that does work is:

#include "/lib/irrlicht-1.6/include/irrlicht.h"

This is a bit ridiculous though, #include should work, I don't understand why it isn't working.

Update (here are more details on the error):

/lib/PAL/pal_benchmark/palBenchmark/main.h:31:0
/lib/PAL/pal_benchmark/palBenchmark/main.h:31:22: error: irrlicht.h: No such file or directory
like image 248
Brock Woolf Avatar asked Jan 21 '10 11:01

Brock Woolf


2 Answers

I figured this out. Perhaps someone can comment as to why this is the case.

The Header was located in this directory:

/lib/irrlicht-1.6/include/

If I added that path to: "Header Search Paths" Xcode still wouldn't find the path when I built the project.

Solution: Add the header path to: "User Header Search Paths" instead.

It boggles me why I had to do this, as I frequently add my header paths to "Header Search Paths" and then #includes just work. Hopefully this can help someone else who gets this same issue.

like image 176
Brock Woolf Avatar answered Sep 23 '22 13:09

Brock Woolf


Both

#include <irrlicht.h> 

#include "irrlicht.h" 

should work as long as the "-I" argument to gcc includes the path of the directory enclosing the header file. If irrlicht.h is part of /usr/include the "-I" option is no longer required.

like image 45
diciu Avatar answered Sep 23 '22 13:09

diciu