在Mac OS X Leopard上将GCC 4.2设置为默认编译器 [英] Setting GCC 4.2 as the default compiler on Mac OS X Leopard

查看:219
本文介绍了在Mac OS X Leopard上将GCC 4.2设置为默认编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信肯定有办法做到这一点。正如你可能知道Leopard最新版本的Xcode(实际上我认为所有版本的Xcode)都是GCC 4.0.1和GCC 4.2。 GCC 4.0.1是默认的系统编译器,而GCC 4.2是可以在Xcode项目设置中设置的可选编译器。



有人知道如何将GCC 4.2设置为所有选项的默认编译器?无论我在Xcode中做什么,最好命令行使用和配置脚本仍然使用GCC 4.0.1而不是GCC 4.2。我假设它只是一个更改路径变量或一些这样的情况,但我难住这一个。



任何帮助表示赞赏。感谢。

解决方案

所有配置脚本的命令行用法:

  cd / usr / bin 
rm cc gcc c ++ g ++
ln -s gcc-4.2 cc
ln -s gcc-4.2 gcc
ln -s c ++ - 4.2 c ++
ln -s g ++ - 4.2 g ++

记录当前链接的目标,所以你可以恢复它们,如果你想要。



如果你不想改变系统范围设置,在PATH之前添加一个目录/ usr / bin(比如 $ HOME / bin ),并在那里建立符号链接



我还没有测试过是否这会影响Xcode项目,因为我不使用Xcode(仅命令行)。


I'm sure there must be a way to do this. As you are probably aware the latest versions of Xcode (and in fact I think all versions of Xcode) on Leopard come with GCC 4.0.1 and GCC 4.2. GCC 4.0.1 is the default system compiler while GCC 4.2 is an optional compiler you can set in the Xcode project settings.

Does anyone know how to set GCC 4.2 as the default compiler for all options? Preferably command line use as well as configure scripts still use GCC 4.0.1 rather than GCC 4.2 no matter what I do in Xcode. I'm assuming it is simply a case of changing a path variable or some such but I am stumped on this one.

Any help is appreciated. Thanks.

解决方案

Command line usage for all configure scripts:

  cd /usr/bin
  rm cc gcc c++ g++
  ln -s gcc-4.2 cc
  ln -s gcc-4.2 gcc
  ln -s c++-4.2 c++
  ln -s g++-4.2 g++

Make a record of the current link targets, so you can restore them if you want to.

If you don't want to change the system wide settings, add a directory into PATH before /usr/bin (say, $HOME/bin), and make the symlinks there

I haven't tested whether this affects Xcode projects, since I don't use Xcode (only command line).

这篇关于在Mac OS X Leopard上将GCC 4.2设置为默认编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆