读书人

使用qmake自动编译Qt程序如何设置g+

发布时间: 2013-06-19 10:26:41 作者: rapoo

求助:使用qmake自动编译Qt程序,怎么设置g++的编译选项?
用qmake自动生成makefile,再用make编译Qt程序时,g++的编译选项大概是这么多...:
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN ...

我希望在我的Qt程序中使用一些C++0x的特性,这需要在g++的编译选项中加入这两个:
-std=c++0x -USTRICT_ANSI

即,变成:
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -std=c++0x -USTRICT_ANSI

高手们...请问应该怎样做呢?
[解决办法]
.pro 文件 QMAKE_CXXFLAGS


This variable contains the C++ compiler flags that are used when building a project. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified. The flags specific to debug and release modes can be adjusted by modifying the QMAKE_CXXFLAGS_DEBUG and QMAKE_CXXFLAGS_RELEASE variables, respectively.

[解决办法]
.pro中添一句:
QMAKE_CXXFLAGS += -std=c++0x -USTRICT_ANSI

读书人网 >QT开发

热点推荐