Search code examples
c++qtc++11qt-creator

QT Creator, syntax checking for c++11


How to turn off error highlighting (red wave under the code) for c++11 cycle range-based operators like that?

int myint[] = {1,2,3,4,5};
for (auto x : myint){/**/}

Hover prompt shows "unexpected token :". The code compiles perfectly.

Another issue - the autocomplete doesn't show unique_ptr in std:: namespace, though compiles OK.

  • Qt Creator 2.4.0 Based on Qt 4.7.4 (32 bit) Built on Dec 12 2011 at 01:10:32

Solution

  • If you're writing in C++11 you should change from using QT Creator as the IDE to using Eclipse CDT. At least this is how I solved this problem. QT Creator doesn't seem to have any way to customize this real-time syntax checking. Eclipse on the other hand is extensively customizable in this regard.

    Update: I think that QtCreator has improved its support for newer versions of C++ since this answer was given, so it is no longer correct. I can't delete it as it is an accepted answer.