KDevelop semantic analysis ".h" file not found

I am recently considering to use KDevelop to develop Qt software in general rather than just KDE software.

The main issue I have is the semantic analysis that produces warnings all over and prevents me from Ctrl+clicking:

I imported this project using the .pro included in the source code

I’ve tried looking for an answer but:

  1. Including the exact file under “Open Configuration > Language Support > Includes/Imports”.
  2. Changing the “include_directories” in CMakeLists.txt.
  3. Disabling Clang-Tidy, Clazy and Cppcheck supports under “Configure KDevelop > Plugins”.
  4. Changing the Compiler Path under Language Support to GCC “already set be default”.
  5. Enabling system headers in Clang-Tidy and Cppcheck.

all did not solve the issue. If you’d like to reproduce this problem, you can:

  1. Clone a Qt project like QGC https://github.com/mavlink/qgroundcontrol with:
git clone --recursive -j8 https://github.com/mavlink/qgroundcontrol.git

as instructed in their developer guide.

  1. Get KDevelop and open their qgroundcontrol/qgroundcontrol.pro
  2. Refer to qgroundcontrol/src/Vehicles/Autotune.cpp line 12 for example.

If someone is able to build this project in KDevelop instead of the standard Qt Creator (which is currently still visually broken when using Breeze Dark in Plasma) that’d be a plus. Thanks!

KDE Neon 5.27
Qt 5.15.9
KDevelop 5.11.230401 (23.04.1)

Semantic analysis and compilation seem to work with my KDevelop flatpak, no warnings. I can’t seem to make its LSP work (like suggestions when typing #include <), though. Don’t know if it’s a known issue with the flatpak.

Going to Preferences → Environment → Theme and setting it to Design Dark or Flat Dark should do. It’s not consistent with Breeze, but it’s definitely not broken for me. The only issue I see is the icons in Ok/Apply/Cancel buttons being dark when they should be light.

Okay I’m on the Flatpak version of KDevelop 5.11.230401 released on 11/05/23. All of the warnings have gone away like you said, but it seems that the semantic analysis is not actually working (no Ctrl+Click, some syntax highlighting is missing). Is there a way to get the semantic analysis properly working?

Also, the Qt Creator looks much nicer now that I changed the theme like you said. Thanks for the advice!

Bump. This is still unsolved, and has been a major unsolved issue for many developers using KDevelop for Qt development as none of the original posters on Stack Exchange ever got their answer from what I have searched.

Perhaps this is a KDevelop bug that prevents detection of include files even if you manually configured the project settings to include the paths of all 100 .h files in your project, or perhaps this is just C++ being an awful language again?

I fixed this by adding a print statement to cmake to give the complete flags passed to g++.
Then copied the output to the project/open configuration/language support/c,c++ parser/c++ profile/custom input, and set compiler for path (lower right) to gcc

Oh how I had missed ctrl-click to go to declarations.