OSX Mountain Lion에서 c 파일을 컴파일하고 싶습니다. Xcode 4.4에서는 환경 설정 -> 다운로드를 위해 명령 줄 도구를 설치할 수 있습니다. 그러나 그 창에 내가 대신 xcrun 사용할 수있는 저를 조언 :xcrun gcc에서 헤더 파일을 찾을 수 없습니다.
Before installing, note that from within Terminal you can use the XCRUN tool to launch compilers and other tools embedded within the Xcode application. Use the XCODE-SELECT tool to define which version of Xcode is active. Type "man xcrun" from within Terminal to find out more.
나는 그런 식으로 그것을 할 드리겠습니다,하지만 난 문제가 STDIO.H을 찾아 그것을 얻는 데 문제가 있습니다.
$ xcrun gcc hello.c
hello.c:1:19: error: stdio.h: No such file or directory
나는 확실히 표준 앱 스토어를 통해 엑스 코드의 설치 한 후 내 시스템에이 파일이
: /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10 .8.sdk는/usr/포함/STDIO.H
내가 SDK를 지정 시도했지만 같은 오류가있어: 일부 인터넷 검색 위의 명령을하기 전에 엑스 코드 - 선택 실행하려고 저를 주도
을$ xcrun -sdk /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk gcc hello.c
하지만, 불운. 어쨌든 한 버전의 Xcode 만 설치했습니다.
$ sudo xcode-select -switch /Applications/Xcode.app
나는이 헤더를 찾는 방법을 얻을 수 있나요?
궁극적으로 저는 명령 줄 도구를 포기하고 설치했지만 내장 된 Xcode 도구를 사용하여이를 수행하는 방법을 알고 있으면 좋을 것입니다.
참고 : 컴파일러에 대한 표준이 아닌 SYSROOT를 지정해야합니다
#include <stdio.h>
int main() {
printf("hello world!\n");
return 0;
}
예 그게 매우 도움이 시점이 아니다 않더라도를 질문에 대한 대답. –