Unsolved Clang Code Model - QtCreator 4.6.1 vs 4.7.0
-
Hey all,
Upgraded yesterday from QtCreator 4.6.1 to 4.7.0 (running on Debian 8). I noticed some things which I would like to discuss and see if there is something wrong on my system/project/setup or it would be a bug in QtCreator itself.
To note; I have used the same source files and cmake configuration in both versions, so there is no difference in the input. Project also builds fine, so the errors/warnings do not have any impact there.
-
This code model could not parse an included file
When opening an .cpp file I get a warning on top of the file saying 'The code model could not parse an included file, which might lead to incorrect code completetion and highlighting'. Warning is on the file 'c++0x_warning.h'; however in the previous version of QtCreator I didn't have this warning. -
no template named 'shared_ptr' in namespace 'std'
The warning on top of the file is the same 'the code model could not parse...', however this time in a header file it shows the message 'error: no template named 'shared_ptr' in namespace 'std''. This warning is coming from an included file lower in the source tree. If I open that file, the warning is gone and I can click on the shared_ptr to end up in the shared_ptr class. So, it seems to have problems resolving includes in headers, which include other headers, and so on?
Questions, remarks, feedback are welcome.
Thanks
-
-
hi @PbvS,
did you upgrade with the Qt MaintenanceTool? I.e. are you using a precompiled Creator from qt.io?
The precompiled package ships a new version of libclang with C++17 support.
So it may be, the compiler flags are not correctly passed to libclang.
Which C++ standard does your code use?
Regards
-
Hey @aha_1980 ,
Thanks for you're reply! I did download QtCreator and used the .run file to install, so precompiled.
I'm using C++14.
Is there some way I could get more information? I have already used the flags to get more info from the clangbackend, but it only shows the errors I also see in the screen (no additional files not found, or whatever).
-
Hi @PbvS,
I'm using C++14.
Ok, which project manager do you use? QMake? Then do you have
CONFIG+=c++14
in your.pro
file?Is there some way I could get more information?
You could try the debugging steps mentioned in https://wiki.qt.io/Qt_Creator_Clang_Code_Model
Maybe this gives some new insight...
-
@aha_1980 I'm using cmake. Tried using add_definitions("-std=c++14") as well as set(CMAKE_CXX_FLAGS "-std=c++14"). Found on the internet also another approach using add_compile_options(-std=c++14) but also no luck.
By the way still on cmake 3.0.2.
I have tried the debugging, didn't see any helpfull information. Will try again and post it later here.
-
@PbvS said in Clang Code Model - QtCreator 4.6.1 vs 4.7.0:
I'm using cmake.
Ok, I'm out here...
Tried using add_definitions("-std=c++14") as well as set(CMAKE_CXX_FLAGS "-std=c++14"). Found on the internet also another approach using add_compile_options(-std=c++14) but also no luck.
The flags needs to be passed to the Code Model - no idea how this works for Cmake.
You might also ask this question on the Creator mailing list...
Regards