Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator Preprocessor - Include error in header files (CMake-Build)
Forum Updated to NodeBB v4.3 + New Features

QtCreator Preprocessor - Include error in header files (CMake-Build)

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
3 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wychmaster
    wrote on last edited by
    #1

    Hi everybody.

    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

    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)

    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?

    Greetings

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • W Offline
        W Offline
        wychmaster
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved