Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
Qt Creator 6.0.2
-
-
498418bbc9 (qt-creator/qt-creator/8.0) 498418bbc9 (qt-creator/qt-creator/master) 498418bbc9 (qt-creator/tqtc-qt-creator/8.0)
Description
When using CMake and the experimental cppcheck plugin, if the CMake project file uses qt_add_qml_module, .h header files are considered C style.
.../testobject.h
.../testobject.h:6: Code 'classTestObject:' is invalid C code. Use --std or --language to configure the language.
Doing the suggested --std or --language flags do not change anything. Following warning is shown in the Qt Creator, but selecting the suggested parser output for C++ does not help either. See attached image.
Note: Multiple parse contexts are available for this file. Choose the preferred one from the editor toolbar.
This can be reproduced with the for example the "adding" Qt example (<examples>\qml\referenceexamples\adding). In that project the culprit lines in CMakeLists. are:
qt_add_qml_module(adding URI People VERSION 1.0 QML_FILES example.qml NO_RESOURCE_TARGET_PATH )