Tod*_*orf 3 c xcode textmate gcc
OS X 10.8
Xcode 4.4.1安装了
TextMate 2 -r9283
在安装了Xcode 4.4的10.8上的TextMate2中编译并运行一个简单的C程序会给出路径错误,然后是编译器错误,然后是链接器错误.
test.c在TextMate2中调用的文件并保存到桌面将此程序粘贴到test.c文件中:
#include <stdio.h>
int main(int argc, char const *argv[]) {
printf("Hello World\n");
return 0;
}
command-R为运行stdout运行程序的输出
TextMate输出面板显示此PATH错误:
Can't find “gcc” on PATH.
The current PATH is:
/usr/bin
/bin
/usr/sbin
/sbin
/Users/itod/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/bin
Please add the directory containing “gcc” to PATH in TextMate's Shell Variables preferences.
Run Code Online (Sandbox Code Playgroud)
然后这个编译错误:
cc1: error: stdio.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)
然后这个链接器错误:
ld: library not found for -lcrt1.10.6.o
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
要在OS X 10.8上构建和运行C程序的TextMate 2,您必须在TextMate中使用几个环境变量.
?,)>变量PATH - $PATH:/Applications/Xcode.app/Contents/Developer/usr/bin/
C_INCLUDE_PATH - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/
LIBRARY_PATH - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/
