在Mac OS上,最新版本的GCC(4.6)如何与Qt一起使用? [英] How a recent version of GCC (4.6) could be used together with Qt under Mac OS?

查看:315
本文介绍了在Mac OS上,最新版本的GCC(4.6)如何与Qt一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题与此处讨论的问题有关:



在Mac OS上尝试运行基于Qt的程序时,它在辅助线程中具有OpenMP子句,它崩溃了。浏览网页后,现在我明白它是由Apple提供的gcc的相当旧版本(4.2)中的错误引起的。

然后,我下载了最新版本来自
http://hpc.sourceforge.net 的4.6版gcc试图编译这个项目,但是我得到了g ++编译器出现以下错误:

无法识别的选项'-arch'
无法识别的选项'-Xarch_x86_64'



我了解到这是因为这些选项只能由自定义配置的Apple-gcc编译器解释,而不能由标准gcc解释。

任何人都可以帮我解决这个问题,并配置g ++ 4.6与Qt一起使用,以获得无bug的OpenMP支持?我承认我是Mac OS平台下的编译器和编程方面的新手,并希望从Visual Studio-Qt环境移植我的代码。



非常感谢您! 解决方案

害怕搞乱你的Qt安装,然后改变〜/ QtSDK / Desktop / Qt / 4.8.1 / gcc / mkspecs / common / g ++ - macx.conf中的QMAKE_CFLAGS_X86_64条目。



将'-Xarch_x86_64'替换为'-arch x86_64'。


My problem is related to the one discussed here:

Is there a way that OpenMP can operate on Qt spanwed threads?

Upon trying to run my Qt-based program under Mac OS that has an OpenMP clause in a secondary thread, it crashed. After browsing through the web, now I understand that it is caused by a bug in the rather old version (4.2) of gcc supplied by Apple.

Then I downloaded the latest 4.6 version of gcc from http://hpc.sourceforge.net and tried to compile the project, but I got the following errors from g++ compiler:

unrecognized option ‘-arch’ unrecognized option ‘-Xarch_x86_64’

I learned that this is because these are options, which can be only interpreted by the custom-configured Apple-gcc compiler, but not by standard gcc.

Could anybody please help me could I overcome this issue and configure g++ 4.6 to use with Qt in order to get a bug-free OpenMP support? I admit that I'm a newbie under Mac OS platform with regard to compilers and programming and would like to port my code from Visual Studio-Qt environment.

Many thanks in advance!

解决方案

If you aren't afraid of messing with your Qt installation, then change the QMAKE_CFLAGS_X86_64 entry in ~/QtSDK/Desktop/Qt/4.8.1/gcc/mkspecs/common/g++-macx.conf.

Replace ‘-Xarch_x86_64’ with ‘-arch x86_64’.

这篇关于在Mac OS上,最新版本的GCC(4.6)如何与Qt一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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