在Qt,QtCreator和QMake中配置GCC编译器切换 [英] Configuring the GCC compiler switches in Qt, QtCreator, and QMake

查看:6114
本文介绍了在Qt,QtCreator和QMake中配置GCC编译器切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近尝试使用 Qt Creator 1.3.2,Qt 4.6.2和GCC 4.4.0(32)位版本)在Windows 7(64位)上使用一些实验C ++ 0x扩展编译应用程序,并遇到以下(致命)错误:

I recently tried to use Qt Creator 1.3.2, Qt 4.6.2, and GCC 4.4.0 (32-bit version) on Windows 7 (64-bit) to compile an application using some of the experimental C++0x extensions and encountered the following (fatal) error:


此文件需要编译器和库支持即将到来的
ISO C ++标准C ++ 0x。此支持目前是实验性的,必须使用-std = c ++ 0x或-std = gnu ++ 0x编译器选项启用

This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.

在我搜索解决方案时,我遇到了线程 qmake和编译器标志? ,并将以下内容添加到.pro文件中:

In my search for a solution, I came across the thread qmake and compiler flags?, and added the following to the .pro file:

CXXFLAGS += -std=c++0x

但这似乎没有什么区别。

but that didn't seem to make a difference.

所以,我希望有一些标签,我需要添加到.pro(项目)文件,但我从来没有搞砸的GCC编译器开关在Qt,QMake ,和QtCreator之前,我不确定正确的调用/咒语。所以,我的问题是如何使用QtCreator,QMake和Qt时设置GCC编译器开关?

So, I expect there's some tag I need to add to the .pro (project) file, but I've never messed with the GCC compiler switches in Qt, QMake, and QtCreator before, and I am uncertain about the proper invokation / incantation. So, my question is how do you set GCC compiler switches when using QtCreator, QMake, and Qt?

推荐答案

请阅读手册。您不必在.pro文件中使用 CXXFLAGS ,您需要使用 QMAKE_CXXFLAGS ,如:

It boils down to reading the manual. Instead of using CXXFLAGS in the .pro file, you need to use QMAKE_CXXFLAGS as in:

main.cpp:

#include <cinttypes>

int main() { return 0; }

main.pro:

SOURCES += main.cpp
QMAKE_CXXFLAGS += -std=c++0x

这篇关于在Qt,QtCreator和QMake中配置GCC编译器切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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