QtCreator 2.6.2 - c++11 support



  • Hello,

    I am currently using @QMAKE_CXXFLAGS += -std=c++11@

    But a lot of features are still missing, are there any other options? Maybe some experimental features?


  • Moderators

    [quote author="kantaki" date="1362246384"]
    But a lot of features are still missing, are there any other options? Maybe some experimental features?[/quote]

    Where are those feature missing?

    Qt creator is "only" an IDE. You are showing qmake flags which are also interpret by creator. Those are past on to the compiler. However, the compiler might be the limiting factor then.



  • I thought it also makes QtCreator aware that I am using c++11.

    Well, it doesn't matter. Features like vector initialization are missing. I am just asking if there is an experimental command to enable more c++11 IDE features.


  • Moderators

    Qt creator awareness of c++11 should be somewhere in the plugins, I guess. However, I am nor aware of a place to set options.



  • Please post an example of your non-working code, initializer lists should work for quite some time now (although I have to admit that I'm using the 2.7 branch, you might also try the clang branch).



  • Thanks I completely forgot about QtCreator clang. I will test it now.

    @
    struct points {
    GLint x;
    GLint y;

    points(GLint x, GLint y): x(x) , y(y) {}
    

    };

    vector<points> p {
    points(1,2)
    };@
    which compiles fine under gcc, clang.



  • Ok this works in the clang version. But I still have one major issue. It is not even an c++11 feature.

    If i create an vector something like @vector<myclass> v;@ and I acces and element via @v[0].@ I don't get any auto complete.

    This happend in all version that I tried. Maybe it is a bug? I am running Qtcreator on Linux.


  • Moderators

    As you stated it has nothing to do with c++11.

    Tried with Qt creator 2.6.2
    @
    std::vector<int> v; // auto complete does work for vector

    vector <double> v1; // auto complete does work for vector and double, but does not compile

    using namespace std;
    vector <double> thisIsANiceLongName; // auto complete does work for vector and double

    thisIsANiceLongName = 0; // auto complete does work with the first 3 letters, but does not compile
    @

    v and v1 are a bit short for auto completion.

    [edit: Just in case of any doubt, I have added the compile results. ;-) ]



  • Okay I think I made a mistake. I actually have no idea how it is called. In visual studio it is called intellisense.

    @struct test{
    int x;
    };

    vector<test> v;

    test t1;

    v.push_back(t1);

    v[0]. // v now should list the member variables of class test, but it doesnt (by pressing ctrl + space)@


  • Moderators

    OK. I see what you mean.

    In that respect there are some deficiencies compared to MSVC Instellisence. I got also used to it and miss it a bit. Also if you are using an iterator for one of the standard containers.
    @
    #include <map>
    void foo1()
    {
    map<int, int > someMap;
    for ( map<int, int>::const_iterator it = someMap.begin(); it != someMap.end(); ++it )
    {
    cout << it->first << endl;
    }
    }
    @
    Completion elements in the for line are offered including const_iterator, begin() and end(). But nothing comes up when typing it->

    @
    #include <QMap>
    void foo()
    {
    QMap<int, int > someMap;
    for ( QMapIterator it = someMap.begin(); it != someMap.end(); ++it )
    {
    cout << it.key () << endl;
    }
    for ( QMap<int, int>::ConstIterator it = someMap.begin(); it != someMap.end(); ++it )
    {
    cout << it.key () << endl;
    }
    }
    @
    For the QMap variant it is working for all possibilities. However, this does not look like a pointer.
    Note: the above QMap code does probably not compile. The correct syntax seems to be actually different. For correct syntax check out "this":http://qt-project.org/doc/qt-4.8/qmapiterator.html

    @
    struct struct_tst {
    double x;
    double y;
    };

    void foo3 ()
    {
    struct_tst pnt;

    pnt.x = 0;
    
    struct_tst *ptr = new struct_tst;
    
    ptr->x = 0;
    

    }
    @

    The auto-completion does feature also the pointer.

    Overall I like qt creator's way better than Intellisense from msvc2005.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.