[Qt-creator] How set __cplusplus more than 201103L in QtC Editor?

Nikolai Kosjar nikolai.kosjar at qt.io
Wed Jan 3 09:12:07 CET 2018


On 01/02/2018 06:51 PM, Карелин Павел wrote:
> 
> 
> 02.01.2018 11:40, Eike Ziller пишет:
>>
>>> On 1. Jan 2018, at 18:39, Карелин Павел<hkarel at yandex.ru>  wrote:
>>>
>>>
>>>
>>> 01.01.2018 20:34,timur.kristof at gmail.com  пишет:
>>>> Did you try with the clang code model?
>>> I use the GCC compiler only. Is it possible to use the clang model in this case? In addition, I have a fairly old OS: Ubuntu 14.04.
>> Which compiler you use for compiling your code does not really matter for the decision on the code model that you use in Qt Creator (except possibly in borderline cases that you probably do not care about...). Even compiler specific defines should be correctly identifying your compiler to be GCC when you specify this in the kit.
>> So you should definitely try the Clang code model - it handles many template situations and most C++11/14/17 situations much better than the built-in model.
>>
>> Br, Eike
> a) Failed to build the  "Clang Code Model" plugin on my system (Kubuntu 
> 14.04). Cause: On "my" system can install llvm-3.9, but I do not have 
> the file /usr/lib/llvm-3.9/include/llvm-s/Inndex.h, so the validation of 
> the clanProbes does not work.

You probably need to install the dev package, too. Try libclang-3.9-dev.

> b) I installed the pre-build QtC 4.5.0. ClangCode model - works. The 
> std::condition_variable highlighting correctly, but many warnings from 
> system header-files that I would prefer not to see. I assume that the 
> system header-files are written correctly ;)

Note that you can adapt the warnings options in Menu: Tools > Options > 
C++ > Code Model. But yes, it would be probably a good idea to use a 
different set of warning options for system includes/headers.

> c) I decided to dwell on the original version, but slightly modified. I 
> add "-std=c++11" in the function languageOption()
> 
> static const QStringList languageOption(Core::Id languageId)
> {
>      if (languageId == Constants::C_LANGUAGE_ID)
>          return {"-x", "c"};
>      return {"-x", "c++", "-std=c++11"};
> }

That's of course a hack :) The project manager is supposed to find out 
the version.

> Now the std::condition_variable highlighting correctly.
> So far I have decided to stop on it variant.
> 
> BR, Pavel.
> 
>>
>>>> On Mon, 2018-01-01 at 20:17 +0300, Карелин Павел wrote:
>>>>> Hi! I congratulate all with come New year!
>>>>>
>>>>> In my project I use std::condition_variable. But using std::condition_variable is not very convenient, since its methods are not available in the QtC editor. See picture in attachment.
>>>>> How to make std::condition_variable methods accessible?
>>>>> I use QtC 4.5 gitrev: 30bd05b792259a559e98c6a19035f7b6adaac1ce
>>>>>
>>>>> --
>>>>> BR, Pavel Karelin
>>>>> _______________________________________________
>>>>> Qt-creator mailing list
>>>>>
>>>>> Qt-creator at qt-project.org
>>>>> http://lists.qt-project.org/mailman/listinfo/qt-creator
>>> _______________________________________________
>>> Qt-creator mailing list
>>> Qt-creator at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/qt-creator
> 
> 
> 
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
> 




More information about the Qt-creator mailing list