gpt4 book ai didi

c++ - Qmake 不使用 stdc++11 编译标志

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:43:15 26 4
gpt4 key购买 nike

当我尝试编译我的项目时,我遇到了这个错误:

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

#-------------------------------------------------
#
# 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 在我 friend 的电脑上运行良好,但是当我克隆它时我无法编译它。

最佳答案

这意味着您的编译器不以这种方式支持 c++11。如果您确定您的编译器不是那么旧,请试试这个:

CONFIG += c++11

关于c++ - Qmake 不使用 stdc++11 编译标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36689371/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com