[SOLVED][Linux] make_unique and GCC compiler
I am porting code from Visual Studio 2013. One of the functions use make_unique
@myVar = make_unique<T>(...)@
I get the following error:
@'make_unique' was not declared in this scope@
I googled a bit and have found that 'make_unique' should be part of gcc4.9. Hence, I installed gcc4.9 on my system and compiled Qt5.3.2 and QtCreator using gcc4.9.
The problem is that I still get the same error. Can anyone tell me how to proceed?
std:: make_unique is part of C++14. You need to compile with this option:
Thanks a lot for the reply.
Not sure if I did it correct. I added
@QMAKE_CXXFLAGS += -std=gnu++14@
to my .pro file
It still fails and I see the following compile output
@g++ -c -std=gnu++14 -g -std=c++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_CORE_LIB -I../../../../dev/qt5/qtbase/mkspecs/linux-g++ -I../../../BeatQtPlayer/src/MediaButlerMixSchedule -I../../../BeatQtPlayer/src -I../../../../dev/qt5/qtbase/include -I../../../../dev/qt5/qtbase/include/QtCore -I. -I. -o ScheduleCtrlV2.o ../../../BeatQtPlayer/src/MediaButlerMixSchedule/ScheduleCtrlV2.cpp@
I'd assume that the issue is '-std=c++0x' (?!) If that's the case, how do I get rid of this option?
I can't see the error in your output, but I would think you are right. You can try
QMAKE_CXXFLAGS -= -std=C++0x
But I have no idea to tell you the thruth. I just know you need
c++14 for that make_unique.
@CONFIG += c++14@
to my .pro file fixed the problem