QtCreator Preprocessor - Include error in header files (CMake-Build)
I have a problem which is probably related to my QtCreator setup or Linux setup. I installed everything (QtC, CMake, Ubuntu etc.) on a new computer. Afterwards i pulled the source files from a project I am working on with git. After navigation to the root CMakeLists.txt and running CMake in QtCreator the setup went as expected and I can compile the whole program. However, there is an error that is really annoying:
We have "src" directory in the root directory of our program. Because we don't want to write "src" every time we include a header, we have written
in our root CMakeLists.txt. This always worked on all of our computers but on the new one, QtCreator now marks all includes without src as "No such file or directory". But this is only the case for header (.h) files/include only files . In our source (.cpp) files this problem does not occur. This also effects the auto code completion, which makes it really annoying. If I add the "src" to the path, then QtCreator finds the headers and everything IDE-related works again, but now I can't compile the program anymore, because we did not specify our root directory as include path (and we don't want to do that).
So it seems that QtCreator does not use the CMake-Setup for all files that aren't mentioned in any CMakeLists.txt. This was never an issue before and I think I have messed up something during the installation. I also tried an older version of QtCreator and got the same error. Maybe because it shares the error related files with the newer version or it has nothing to do with QtCreator and is a general setup problem on the computer. Any ideas?
Hi and welcome to devnet,
One thing you can try is to delete the
.userfiles that Qt Creator creates and then retry with your older Qt Creator version.
Hope it helps
I tried your suggestion and more. I also removed qt creator completely and deleted the related files I found in the .config and the .local directory. I pulled the source files into a fresh directory and tested it with both QtCreator versions. Error stays the same. Unless I have missed a file when I removed qtcreator, it might be system related. I ll try it again in gnome. Currently I am using the kde plasma desktop and it caused several non related issues before. Maybe there is another one. If you have any other idea, let me know!
Is there the possibility to configure qtcreator where to search for header files? Maybe I can solve my problem this way if anything else fails.