Xcode 4.3.3 can't find any header files

slabofguinness picture slabofguinness · Jun 20, 2012 · Viewed 10.4k times · Source

Up until now I've managed to get Xcode to link to the Gnu Scientific Libraries (GSL) which I've installed under /usr/local/lib/ and with header files under /usr/local/include. Under "Build Phases" > "Link Binary With Libraries" I had added libgsl.a etc. Today, Xcode gives an error message claiming it can't find header files.

For example

#include <stdio.h>
#include <gsl/gsl_matrix.h>

int main(int argc, const char * argv[])
{

    printf("Hello, World!\n");
    return 0;
}

results in 'gsl/gsl_matrix.h' file not found. I've tried to change the User Header Search path to no avail. Using gcc main.c -lgsl -lgslcblas on the command line works perfectly. Could anyone tell me what exactly one needs to do to get this to work in Xcode? Also, why has it suddenly stopped working for no apparent reason.

Many kind thanks.

Answer

Usman Rashid picture Usman Rashid · Jun 21, 2012

I had same problem when I upgraded to 4.3.3 with include files installed in my /usr/local/include folder. After some head banging, I discovered that I had to add /usr/local/include to the "Header Search Paths" setting under Search Paths in Project Build Settings. I did NOT have to do that in the previous version of XCode. Don't know why it changed, but hope this works for you.