安装GCC 4.7,但我的mac目前使用4.2。我怎么换呢?
一些可能有用的细节:
操作系统:狮子10.7.5
GCC: 4.2.1
GCC之路4.2.1: /usr/bin/gcc
GCC 4.7之路: /usr/local/bin/gcc-4.7
发布于 2013-10-18 05:24: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,http://solarianprogrammer.com/2013/06/11/compiling-gcc-mac-os-x/安装mpc,mpfr和gmp )
2.$brew link gcc48
3.备份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个步骤
@"Donny“:您可以跳过4步
5.制作插件
1)下载GCC 4.5的Xcode插件
2)将"4.5“改为"4.8","4_5”改为"4_8",文件名,文件内容,
除了文件GCC 4.5.xcspec
中的“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"
(@"Donny“:您可以将其更改为"/usr/local/bin/gcc-4.7")
或ExecPath = "/usr/local/Cellar/gcc48/4.8.2/bin/gcc-4.8"
(用于安装gcc-4.8的人用brew)
或者ExecPath = "/usr/bin/gcc"
(对于完成第4步的人来说)。
(4)删除GCC 4.8.xcspec
文件中的“-wcmp-64-to-32”部分。
{
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]";
}
6.将编辑后的GCC 4.8.xcplugin
放入
/Applications/Xcode.app/Contents/Plugins/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/
7.重新打开Xcode。
现在,新插件已经为您准备好了。您可以在项目的“构建设置”的“C/C++/Objective编译器”中看到您的新GCC编译器插件
8.更改Xcode项目中的生成设置
1)在Xcode中的project
和target
设置中
将“C/C++/Objective编译器”改为"GCC 4.8“
2)在project
设置中
删除“CLANG_CXX_LIBRARY”行
https://stackoverflow.com/questions/18948695
复制相似问题