5

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 \

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

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

CE_
  • 1,078
  • 2
  • 16
  • 33

1 Answers1

2

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
VP.
  • 15,509
  • 17
  • 91
  • 161
  • `gcc version 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)` ,your solution doesn't seems to work – CE_ Apr 18 '16 at 08:56
  • It works on my configuration : `g++ -c -pipe -Wall -Wextra -Wno-deprecated-declarations -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB -I../../../KinematicUI -I. -Iinc -I../../../criifLib/include -I/opt/Qt/5.6/gcc_64/include -I/opt/Qt/5.6/gcc_64/include/QtOpenGL -I/opt/Qt/5.6/gcc_64/include/QtWidgets -I/opt/Qt/5.6/gcc_64/include/QtGui -I/opt/Qt/5.6/gcc_64/include/QtXml -I/opt/Qt/5.6/gcc_64/include/QtCore -I. -I. -I/opt/Qt/5.6/gcc_64/mkspecs/linux-g++ -o main.o ../../main.cpp` – Boiethios Apr 18 '16 at 09:17
  • @Morovaille That's the problem, it works with my friend's computer but it doesn't compile on mine – CE_ Apr 18 '16 at 09:35
  • 3
    You need to run qmake after you make changes to the .pro file. (Top level menu option "Build" => "Run qmake") Otherwise it won't work. – Elijan9 Apr 18 '16 at 09:38
  • @CE_ make sure you did clean your project before. – VP. Apr 18 '16 at 09:56
  • 1
    @CE_ also you don't need to run qmake to change the .pro file, qmake is needed to generate the Makefile by your .pro file that is used by `make` utility to compile your project. `.pro` file is nothing more that just a simple way of describing make-file. – VP. Apr 18 '16 at 10:06