SUMMARY When using the pch-feature of cotire (https://github.com/sakra/cotire) (or I guess precompiled headers created by gcc in general) the clang-pluging (background parser) is trying to use them and fails, resulting in non-working code-completing. STEPS TO REPRODUCE 1. Create c++ cmake project, include cotire 2. add_executable(<target name> <at least a couple of sources>) 3. cotire(<target name>) OBSERVED RESULT No code-completion in kdevelop EXPECTED RESULT Working code-completion in kdevelop SOFTWARE/OS VERSIONS observed with all kde5/kdevelop5/qt5/cmake3.x/cotire versions so far
Now with the precompiled headers available in the core CMake, it is even easier to trigger this bug.
(In reply to Eugene Shalygin from comment #1) > Now with the precompiled headers available in the core CMake, it is even > easier to trigger this bug. That's exactly what happened to me which is how I found this my way to this issue. I started using target_precompile_headers in my project and suddenly the parser stopped working in kdevelop unless I use clang as the compiler.
*** Bug 427002 has been marked as a duplicate of this bug. ***
Created attachment 158128 [details] remove CMake-generated precompiled headers from Clang arguments While we are waiting for a proper fix, I'd like to share my workaround for GCC and CMake. It simply drops cmake-generated -include path/to/cmake_pch.h[xx] arguments from clang invocation command line.
Even if you use clang as the compiler, the parser may still fail with errors like > error: GNU extensions was enabled in PCH file but is currently disabled > error: C11 was enabled in PCH file but is currently disabled (happens with SDL3 on my system). So removing the include may be necessary on it too. Of course it would be better if KDevelop used the exact same compilation mode the build system uses but that may be tricky and in some cases outright impossible.