Details
-
Bug
-
Resolution: Done
-
P2: Important
-
Qt Creator 4.6.1
-
None
-
888ea6bbbb0f4c6bb6b5616046e600b9520e4faf (qt-creator/qt-creator/master)
Description
Summary
If "-include" gets added to CMAKE_CXX_FLAGS in CMakeLists.txt, clang code model does not seem to use this flag, and subsequently reports incorrect errors caused by missing headers.
Minimal example
CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(codeModelBug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${CMAKE_SOURCE_DIR}/pch.h")
add_executable(codeModelBug main.cpp)
main.cpp
int main() { // clang code model: error: use of undeclared identifier 'helloWorld' helloWorld(); return 0; }
pch.h
#pragma once
#include <iostream>
inline void helloWorld()
{
std::cout << "Hello World!" << std::endl;
}
The example can also be found as .zip in the Downloads.
The example compiles and executes fine. Just the clang code model and the syntax completion fail to find the helloWorld function.
Attachments
Issue Links
- relates to
-
QBS-1356 Qbs confused by explicit "-include" when precompiled headers are used
- Closed