Results 1 to 4 of 4

Thread: Compiler and library support for the ISO C++ 2011 standard

  1. #1
    Join Date
    Mar 2009
    Location
    India
    Posts
    8
    Thanks
    2
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Exclamation Compiler and library support for the ISO C++ 2011 standard

    I am trying to create an i2c communication in raspbery Pi(debian wheezy) using Qt creator with rpi-hw library. I successfully compiled and installed the rpi-hw library in my linux system. But when I try to include this in my Qt. Got the following errors.

    /usr/include/c++/4.7/bits/c++0x_warning.h:32: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
    /usr/include/rpi-hw.hpp:159: In file included from /usr/include/rpi-hw.hpp:159:0,
    /home/pi/untitled/main.cpp:2: from ../untitled/main.cpp:2:
    /usr/include/rpi-hw/types.hpp:32: error: 'std::int8_t' has not been declared
    /usr/include/rpi-hw/types.hpp:33: error: 'std::int16_t' has not been declared
    /usr/include/rpi-hw/types.hpp:34: error: 'std::int32_t' has not been declared
    /usr/include/rpi-hw/types.hpp:35: error: 'std::int64_t' has not been declared
    /usr/include/rpi-hw/types.hpp:37: error: 'std::uint8_t' has not been declared


    Any one know how to fix this in my Qt creator. I tried to add -std=gnu++11 in Projects->Build Steps-> Additional arguments but no luck

    Please help.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Compiler and library support for the ISO C++ 2011 standard

    Add to the .pro file
    Qt Code:
    1. CONFIG += c++11
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  3. #3
    Join Date
    Mar 2009
    Location
    India
    Posts
    8
    Thanks
    2
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Post Re: Compiler and library support for the ISO C++ 2011 standard

    Quote Originally Posted by anda_skoa View Post
    Add to the .pro file
    Qt Code:
    1. CONFIG += c++11
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _
    I tried with CONFIG += c++11 in my .pro file but still the same error is showing.

    My .pro file will looks like this
    Qt Code:
    1. TEMPLATE = app
    2. CONFIG += console
    3. CONFIG -= qt
    4. CONFIG += C++11
    5.  
    6.  
    7.  
    8. SOURCES += main.cpp
    9.  
    10.  
    11. #unix:!macx:!symbian: LIBS += -L$$PWD/../Desktop/Rpi-hw-master/build/ -lrpihw
    12.  
    13. #INCLUDEPATH += $$PWD/../Desktop/Rpi-hw-master/include/rpi-hw
    14. #DEPENDPATH += $$PWD/../Desktop/Rpi-hw-master/include/rpi-hw
    15.  
    16. unix:!macx:!symbian: LIBS += -lrpihw
    To copy to clipboard, switch view to plain text mode 

    and my CPP file
    Qt Code:
    1. #include <iostream>
    2. #include <rpi-hw.hpp>
    3. #include <rpi-hw/driver/i2c.hpp>
    4.  
    5. using namespace std;
    6. using namespace rpihw;
    7.  
    8. #define ID_I2C_SLAVE_ADDRESS 0x20
    9. #define ID_I2C_DEV_PATH "/dev/i2c-0"
    10.  
    11. int main()
    12. {
    13.  
    14. rpihw::driver::i2c objI2C(ID_I2C_DEV_PATH, ID_I2C_SLAVE_ADDRESS);
    15.  
    16. char *chData;
    17. int iSize=0;
    18. objI2C.write(chData, iSize);
    19.  
    20. cout << "Hello World!" << endl;
    21. return 0;
    22. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by arunkumaraymuo; 6th May 2014 at 13:50.

  4. #4
    Join Date
    Mar 2009
    Location
    India
    Posts
    8
    Thanks
    2
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Compiler and library support for the ISO C++ 2011 standard

    I solved it myself by adding the following in my PRO files

    QMAKE_CXXFLAGS += -std=c++11

    Determine which flags are required by compiler (and it looks like the error message makes two suggestions). I am posting this here for any one who need this in future.

Similar Threads

  1. Using the standard library with qt creator
    By DragonLance156156 in forum Qt Tools
    Replies: 12
    Last Post: 3rd February 2016, 09:59
  2. Replies: 2
    Last Post: 30th July 2013, 10:05
  3. Replies: 0
    Last Post: 10th June 2013, 02:54
  4. Implementing standard library sockets [SOLVED]
    By callinyouin in forum Newbie
    Replies: 1
    Last Post: 20th March 2011, 23:12
  5. source building a standard gnu library
    By felix in forum Qt Tools
    Replies: 0
    Last Post: 5th March 2009, 18:40

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.