Apple彻底删除了他们曾经拥有的任何GCC支持.有没有办法在Xcode 5中使用最近的GCC(比如4.8)?换句话说,在Xcode中使用GCC代替LLVM.
fro*_*cjn 20
将GCC 4.8安装到Xcode 4.5,Xcode 4.6,Xcode 5.0中:
对于尚未安装GCC 4.8的人:
安装新版本的家酿
您可以找到如何在Internet上安装的方法
将您的brew更新到最新版本($brew update)
1.brew install gcc48 --enable-all-languages
(可能应该通过brew安装mpc,mpfr和gmp,http: //solarianprogrammer.com/2013/06/11/compiling-gcc-mac-os-x/ )
2.$brew link gcc48
3.backup g ++,gpp,c ++,cpp,c ++ in /usr/bin/
4. [可选步骤]:
别名g ++ - 4.8,gpp-4.8,c ++ - 4.8,cpp-4.8,c ++ - 4.8
从 /usr/local/Cellar/gcc48/4.8.2/bin/g++
至 /usr/bin/
[没有安装gcc的开发人员超过4个步骤]
5.make插件
1)下载 GCC 4.5 for Xcode插件
2)将每个"4.5"改为"4.8","4_5"改为"4_8",文件名,文件内容,
除了文件中的"com.apple.compilers.gcc.headers.4_2" GCC 4.5.xcspec.
你可以保持内容English.lproj不变,并删除Japanese.lproj.
3)在档案中 GCC 4.8.xcspec
(希望你已经改变的文件名GCC 4.5.xcspec来GCC 4.8.xcspec)
更改 ExecPath = "...”;
至 ExecPath = "/usr/local/bin/gcc-4.8"
或ExecPath = "/usr/local/Cellar/gcc48/4.8.2/bin/gcc-4.8"(对于通过brew安装gcc-4.8的人)
4)删除文件中的"-Wshorten-64-to-32"部分 GCC 4.8.xcspec
{
Name = "GCC_WARN_64_TO_32_BIT_CONVERSION";
Type = Boolean;
DefaultValue = NO;
CommandLineArgs = {
YES = (
"-Wshorten-64-to-32",
);
NO = ();
};
AppearsAfter = "GCC_WARN_PROTOTYPE_CONVERSION";
Category = Warnings;
CommonOption = NO;
DisplayName = "Implicit Conversion to 32 Bit Type";
Description = "Warn if a value is implicitly converted from a 64 bit type to a 32 bit type.
[GCC_WARN_64_TO_32_BIT_CONVERSION, -Wshorten-64-to-32]";
}
Run Code Online (Sandbox Code Playgroud)
6.put编辑GCC 4.8.xcplugin成
/Applications/Xcode.app/Contents/Plugins/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/
7.reopen Xcode.
现在,新插件已经为您准备好了.您可以在项目的"构建设置"的"Compiler for C/C++/Objective-C"中看到新的GCC编译器插件
8.在Xcode项目中更改构建设置
1)在Xcode 的project和target设置中
将"C/C++/Objective-C编译器"更改为"GCC 4.8"
2)在project设置中
删除"CLANG_CXX_LIBRARY"行
| 归档时间: |
|
| 查看次数: |
20710 次 |
| 最近记录: |