寻找 C/C++可以使用自定义 gcc 安装的 OS X IDE
我使用的是 OS X 10.7.2“Lion”,并且正在开发一个 C 程序,该程序必须使用一些 OpenMP 3.0 特定功能。因此,gcc 4.2.1 对我来说还不够,我需要 gcc 4.4 或更好的版本。
我下载了 MacPorts 并轻松安装了 gcc 4.4。从命令行运行它工作正常,并且可以轻松编译我的 OpenMP 3.0 C 程序。
但在 Xcode 或 TextWrangler 中编辑源代码并从命令行编译它对我来说相当烦人。所以我尝试了Code::Blocks,我花了1个小时试图让它在OS X下工作,但它随时无缘无故地崩溃。然后我尝试了 Eclipse,但即使安装了 gcc 4.4 并且可以从命令行运行,它仍然继续使用 gcc 4.2.1。最后,我尝试了 MonoDevelop,它也使用 gcc 4.2.1,但我不知道如何强制它使用我最喜欢的 gcc 版本。
我想问你的是:是否有任何适合 OS X 的合适的 C/C++ IDE 我可以使用,它可以让我指定要使用的 gcc 版本(就像 Windows 下的 Code::Blocks 一样)没有可怕的解决方法和/或破坏 gcc 4.2.1(我需要它并为 Xcode 工作)?
提前致谢。
I'm on OS X 10.7.2 "Lion", and I'm developing a C program that has to use some OpenMP 3.0 specific functionalities. Therefore, gcc 4.2.1 is not enough for me, I need gcc 4.4 or better.
I downloaded MacPorts and easily installed gcc 4.4. Running it from the command line just works fine, and compiles my OpenMP 3.0 C program with no hassle.
But it's quite annoying for me to edit the source in Xcode or TextWrangler and compile it from the command line. So I tried Code::Blocks, which took me 1 hour trying to make it work under OS X, but it crashes anytime for no reason. Then I tried Eclipse, but it sticks on using gcc 4.2.1 even if gcc 4.4 is installed and can be run from the command line. Finally, I tried MonoDevelop, which uses gcc 4.2.1 as well and I just can't see how can I force it to use my favourite gcc version.
What I'm kindly asking you is: is there any decent C/C++ IDE for OS X that I can use which will let me to specifiy what gcc version to use (just like Code::Blocks under Windows) without horrible workarounds and/or breaking gcc 4.2.1 (I need it up and working for Xcode)?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够在 Xcode 中使用 gcc,而不会破坏现有的 gcc 工具链。请按照这些说明(描述如何使用自定义 clang 构建,但相同的原则适用于 gcc)。
You should be able to use your gcc with Xcode, without breaking the existing gcc toolchain. Follow these instructions (which describe how to use a custom clang build, but the same principle applies to gcc).
Eclipse 没问题,它可以配置为使用任何编译器(或同时使用多个编译器或其他)。
如果您想要全局设置,请转到您的首选项中的
C/C++/Build/Environment
,并将其 PATH 设置为您最喜欢的 GCC 所在的位置。如果您想更具体,您可以编辑特定项目的首选项,例如:
C/C++ Build / Environment
->要设置的环境变量
(您可以在其中找到并自定义每个构建配置的编译将使用的最终路径)C/C++ Build / Settings
->GCC C++ 编译器
(以及其他) - 在这里您可以自定义要执行的编译器的确切二进制文件(默认为g++
),同样是根据构建配置。这甚至可以让您拥有一个具有 2 个构建配置的项目,例如,一个用于 GCC 4.2,一个用于 GCC 4.4。
Eclipse is OK, it can be configured to use any compiler (or several at once or whatever).
If you want a global setting, then go to
C/C++ / Build / Environment
in your preferences and set its PATH to wherever your favourite GCC is.If you want to be more specific, you can edit a specific project's preferences, for instance:
C/C++ Build / Environment
->Environment variables to set
(there you can find and customize the final PATH that your compilation will use, per build configuration)C/C++ Build / Settings
->GCC C++ Compiler
(and others) - there you can customise the exact binary file of the compiler to execute (defaults to justg++
), again per build configuration.This even lets you have a project with 2 build configs, one for GCC 4.2 and one for GCC 4.4 for instance.