I have a CMake project being used within QtCreator with C++17 enabled.
I can compile and use C++17 features without issues. When printing the value of __cplusplus
I get 201703
, but when I hover over the macro in the QtCreator editor it shows a value of 1
.
Because of this, I do not get any code completion or highlighting for any C++11 (and later) features. This makes it annoying to deal with.
Standard headers such as <memory>
have a bunch of checks like:
#if __cplusplus >= 201103L
// unique_ptr and shared_ptr
The editor disables all code under the condition due to the incorrect __cplusplus
value.
Environment:
Is this a known issue with QtCreator and CMake projects? Are there work arounds to get the QtCreator editor to parse the code with the correct __cplusplus
value provided by CMake/GCC?
It seems that QtCreator 4.7.2 has a bug regarding __cplusplus
being defined as 1
. Upgrading to 4.9.0 now correctly defines __cplusplus
as 201703
(for C++17 Cmake project).