Results 1 to 7 of 7

Thread: How can I use C++11?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    29
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I use C++11?

    Yes, I do.

    This is the error I get when I use that option. QMAKE_CXXFLAGS += -std=c++0x

    21:40:12: Running build steps for project untitled3...
    21:40:12: Configuration unchanged, skipping qmake step.
    21:40:12: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
    C:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Debug
    mingw32-make.exe[1]: Entering directory `C:/Users/isto/Documents/QtMobile/untitled3-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug'
    g++ -c -std=c++0x -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -I"..\untitled3" -I"." -I"c:\QtSDK\Desktop\Qt\4.8.0\mingw\mkspecs\win32-g++" -o debug\main.o ..\untitled3\main.cpp
    In file included from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/postypes.h:42,
    from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iosfwd:42,
    from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ios:39,
    from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ostream:40,
    from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iostream:40,
    from ..\untitled3\main.cpp:1:
    c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
    c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared
    mingw32-make.exe[1]: Leaving directory `C:/Users/isto/Documents/QtMobile/untitled3-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug'
    mingw32-make.exe[1]: *** [debug/main.o] Error 1
    mingw32-make.exe: *** [debug] Error 2
    21:40:13: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
    Error while building project untitled3 (target: Desktop)
    When executing build step 'Make'

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How can I use C++11?

    If i remember correctly MingW 4.4 doesn't implement lambda's, so you need to install a newer version of compiler.
    Here is the "0x status" for g++ (i guess the versions should match - in that case you need 4.5 for lambda functions)

  3. #3
    Join Date
    Mar 2011
    Posts
    29
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I use C++11?

    It doesn't really matter. If I add QMAKE_CXXFLAGS += -std=c++0x to the .pro file and even if I just have this:

    Qt Code:
    1. #include <QCoreApplication>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. QCoreApplication a(argc, argv);
    6.  
    7. return a.exec();
    8. }
    To copy to clipboard, switch view to plain text mode 

    UPDATE: This thread http://qt-project.org/forums/%20/viewthread/6731 suggest to use -std=gnu++0x instead of -std=c++0x and now the above code compiles without any errors or warnings. That's with the built-in MinGW compiler.

    So do I need to compile Qt now to use it with MingGW 4.6?

    How long would it take to compile it on a mobile i5 with 3Gb RAM?
    Last edited by Zingam; 13th April 2012 at 09:57.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.