C 프로그래밍에서 오랜 시간을 보낸 후 다시 시도해보기로했습니다. hello.c 프로그램을 컴파일하려고하는데 문제가 있습니다.Mac OS X Snow Leopard에서 GCC 경고 "내장 함수 'printf'가 호환되지 않습니다.
#include <stdio.h>
main()
{
printf("Hello\n");
}
을 그리고 여기 GCC의 출력입니다 : 다음은 코드의 난 맥 실행 스노우 레오파드 (10.6.8)와 엑스 코드 3.2.6 작업입니다
$ gcc -o hello hello.c
hello.c:1:19: error: stdio.h: No such file or directory
hello.c: In function ‘main’:
hello.c:4: warning: incompatible implicit declaration of built-in function ‘printf’
$
.
다음은 'GCC -v'출력입니다 :
$ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
$
GCC는 /Developer/SDKs/MacOSX10.6.sdk/usr/include에 위치한 STDIO.H를 찾을 수 없습니다. 환경 변수를 설정하는 방법에 대해 궁금해하므로 명령 줄에 포함 경로를 지정할 필요가 없습니다.
$ gcc -I/Developer/SDKs/MacOSX10.6.sdk/usr/include -o hello hello.c
ld: library not found for -lcrt1.10.6.o
collect2: ld returned 1 exit status
$
내 LD_LIBRARY_PATH 환경 변수는 다음과 같습니다 :
$ echo $LD_LIBRARY_PATH
/Developer/SDKs/MacOSX10.6.sdk/usr/lib
$
어떤 도움에 감사드립니다 내가 명령 줄을 지정할 때 다른 오류가 발생합니다.
감사합니다, 키스
'/ usr/include'가 있고'stdio.h '가 들어 있는지 확인하십시오. – JeremyP