Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. -std=c++11 or -std=gnu++11 in Qt Creator
Forum Updated to NodeBB v4.3 + New Features

-std=c++11 or -std=gnu++11 in Qt Creator

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jamiil
    wrote on last edited by
    #1

    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.@

    In reality, when you expect less you’ll be disappointed more. The lower you aim, the less fulfilling your life will be.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jamiil
      wrote on last edited by
      #2

      sorry folks, I found the source of the problem. Humm...

      In reality, when you expect less you’ll be disappointed more. The lower you aim, the less fulfilling your life will be.

      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on last edited by
        #3

        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.

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved