-std=c++11 or -std=gnu++11 in Qt Creator
-
How do I add -std=c++11 or -std=gnu++11 to the compiler, using ?
I am trying to compile this code in my Win7, but it gives me an error:
@#include "mainwindow.hpp"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
lblLabel.reset(new lblLabel);
lblLabel->setText(txt)ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
@
The error is:
@19:05:13: Running steps for project QtCppGUI...
19:05:13: Configuration unchanged, skipping qmake step.
19:05:13: Starting: "D:\Qt64\qt-5.2.1-x64-mingw482r2-sjlj\mingw64\bin\mingw32-make.exe"
D:/Qt64/qt-5.2.1-x64-mingw482r2-sjlj/mingw64/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'D:/Temp/build-QtCppGUI-MinGW64-Debug'
g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DQT_NEEDS_QMAIN -I..\QtCppGUI -I"....\Qt64\qt-5.2.1-x64-mingw482r2-sjlj\qt-5.2.1-x64-mingw482r2-sjlj\include" -I"....\Qt64\qt-5.2.1-x64-mingw482r2-sjlj\qt-5.2.1-x64-mingw482r2-sjlj\include\QtWidgets" -I"....\Qt64\qt-5.2.1-x64-mingw482r2-sjlj\qt-5.2.1-x64-mingw482r2-sjlj\include\QtGui" -I"....\Qt64\qt-5.2.1-x64-mingw482r2-sjlj\qt-5.2.1-x64-mingw482r2-sjlj\include\QtANGLE" -I"....\Qt64\qt-5.2.1-x64-mingw482r2-sjlj\qt-5.2.1-x64-mingw482r2-sjlj\include\QtCore" -I"debug" -I"." -I"." -I"....\Qt64\qt-5.2.1-x64-mingw482r2-sjlj\qt-5.2.1-x64-mingw482r2-sjlj\mkspecs\win32-g++" -o debug\main.o ..\QtCppGUI\main.cpp
In file included from ..\QtCppGUI\main.cpp:1:0:
..\QtCppGUI\mainwindow.hpp:25:19: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
QString txt = "Jamiil Testing";
^
..\QtCppGUI\mainwindow.hpp:26:5: error: 'shared_ptr' in namespace 'std' does not name a type
std::shared_ptr<QtLabel> lblLabel;
^
Makefile.Debug:361: recipe for target 'debug/main.o' failed
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make[1]: Leaving directory 'D:/Temp/build-QtCppGUI-MinGW64-Debug'
Makefile:34: recipe for target 'debug' failed
mingw32-make: *** [debug] Error 2
19:05:15: The process "D:\Qt64\qt-5.2.1-x64-mingw482r2-sjlj\mingw64\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project QtCppGUI (kit: MinGW64)
When executing step 'Make'
19:05:15: Elapsed time: 00:02.@ -
sorry folks, I found the source of the problem. Humm...
-
Hi Jamil,
Good you found the problem.
Could you please mark this topic as solved? You can do that by editing the title of you first and add [solved].
Even better would be if you tell us what was the problem / solution so this can be usefull for others encountering the same issues.