slabofguinness
slabofguinness

Reputation: 821

Xcode 4.3.3 can't find any header files

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.

Upvotes: 3

Views: 10506

Answers (3)

giorgos.nl
giorgos.nl

Reputation: 2842

In Xcode 12.x make sure you select the tab All (instead of the preselected basic): enter image description here

Upvotes: 1

Darson
Darson

Reputation: 26

Thanks for help.

In Xcode 4.6 I have to:

  • Change default compiler to: LLVM GCC 4.2

And add this paths:

  • Framework Search Paths: /Library/Frameworks
  • Header Search Paths: /usr/local/include
  • Library Search Paths: /usr/include/lib

Upvotes: 0

Usman Rashid
Usman Rashid

Reputation: 91

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.

Upvotes: 9

Related Questions