Qmake不使用stdc ++ 11编译标志 [英] Qmake doesn't use stdc++11 compilation flag

查看:96
本文介绍了Qmake不使用stdc ++ 11编译标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试编译我的项目时,出现了以下错误:

When I try to compile my project, I've got this error :

g++ -c -pipe -std=c++11 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -std=gnu++98 -Wno-deprecated -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I+= -I../includes -I. -I. -o ThreadPool.o ../sources/ThreadPool.cpp
In file included from /usr/include/c++/5.3.1/thread:35:0,
                 from ../includes/ThreadPool.hpp:4,
                 from ../sources/ThreadPool.cpp:1:
/usr/include/c++/5.3.1/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \

我不明白为什么因为我在我的Makefile文件中使用了标志 -std = c ++ 11

I don't understand why because I use the flag -std=c++11 in my Makefile

#-------------------------------------------------
#
# Project created by QtCreator 2016-04-11T18:51:06
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = plazza_gui


SOURCES +=  main.cpp\
            ../sources/Window.cpp \
            ../sources/ThreadPool.cpp \
            ../sources/ProcessManager.cpp \
            ../sources/Process.cpp \
            ../sources/NamedPipe.cpp \
            ../sources/Xor.cpp \
            ../sources/AEncryptionMethod.cpp \
            ../sources/Cesar.cpp \
            ../sources/ProcessData.cpp \
            ../sources/Parser.cpp

HEADERS  += ../includes/Window.hpp

INCLUDEPATH +=  += ../includes/


FORMS    += forms/mainwindow.ui

QMAKE_CXXFLAGS += -std=c++11

LIBS += \
  -lboost_regex \

DISTFILES += \
    ressources/pizzera.jpg \
    ressources/pizzeria.png \
    ressources/icon.png

RESOURCES += \
    ressources/ico.qrc

Makefile在我朋友的计算机上工作正常,但是当我克隆时

The Makefile works fine in my friend's computer, but when I clone it I can't compile it.

推荐答案

这意味着您的编译器不支持c ++ 11。如果您确定编译器不是旧的,请尝试以下方法:

That means your compiler does not support c++11 in that way. Try this if you are sure your compiler is not that old:

CONFIG += c++11

这篇关于Qmake不使用stdc ++ 11编译标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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