Xcode 4.3.3 can't find any header files

半城伤御伤魂 提交于 2019-12-07 18:51:21

问题


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.


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/11127824/xcode-4-3-3-cant-find-any-header-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!