Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Creator Not Correctly Parsing Includes
Forum Updated to NodeBB v4.3 + New Features

Qt Creator Not Correctly Parsing Includes

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 3.3k 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.
  • N Offline
    N Offline
    nlfortier
    wrote on last edited by
    #1

    I am attempting to import a non-qt project using the "Import Existing Project" dialog. The project imports fine and compiles/runs with no issue. However, every single include is highlighted in red and shows a file not found error. Additionally, "Follow Symbol Under Cursor" does not work. It seems that Qt Creator is having trouble parsing the project, but I cannot figure out how to correct the issue.

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

      Hi and welcome to the forum.
      Did it create a .pro file from "Import Existing Project" ?
      If yes, Could you show it here ?

      Im wondering if it needs some folder for the INCLUDEPATH
      like
      INCLUDEPATH = c:/msdev/include d:/stl/include
      or something like that ?
      Its hard to guess at with know idea about project structure and subfolders :)

      However, it sounds odd it compiles and runs but all includes are red.

      N 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi and welcome to the forum.
        Did it create a .pro file from "Import Existing Project" ?
        If yes, Could you show it here ?

        Im wondering if it needs some folder for the INCLUDEPATH
        like
        INCLUDEPATH = c:/msdev/include d:/stl/include
        or something like that ?
        Its hard to guess at with know idea about project structure and subfolders :)

        However, it sounds odd it compiles and runs but all includes are red.

        N Offline
        N Offline
        nlfortier
        wrote on last edited by
        #3

        @mrjj No pro file was created, but there is an .includes and a .files file. These files list all of the included directories and files respectively. I followed the instructions here and they did not mention a .pro file. I would show you the sub-folders and structure but it is a complex project.

        mrjjM 1 Reply Last reply
        0
        • N nlfortier

          @mrjj No pro file was created, but there is an .includes and a .files file. These files list all of the included directories and files respectively. I followed the instructions here and they did not mention a .pro file. I would show you the sub-folders and structure but it is a complex project.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @nlfortier
          Ok, i though it would. ignore that then.
          Maybe its the code model that is acting up ?
          Could try disable it for a moment ?
          menu: Help->About Plugins then
          alt text

          and restart creator. then open and see if includes are still red.

          N 1 Reply Last reply
          1
          • mrjjM mrjj

            @nlfortier
            Ok, i though it would. ignore that then.
            Maybe its the code model that is acting up ?
            Could try disable it for a moment ?
            menu: Help->About Plugins then
            alt text

            and restart creator. then open and see if includes are still red.

            N Offline
            N Offline
            nlfortier
            wrote on last edited by
            #5

            @mrjj Thanks! That was helpful. I still can't use "Follow Symbol Under Cursor" on classes defined in different sub-folders, but the annoying red highlighting is gone.

            aha_1980A 1 Reply Last reply
            0
            • N nlfortier

              @mrjj Thanks! That was helpful. I still can't use "Follow Symbol Under Cursor" on classes defined in different sub-folders, but the annoying red highlighting is gone.

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @nlfortier you need to properly set up the include paths in .includes and add predefined macros to .config

              Then it will work fine, probably even with Clang. I use it everyday in many projects.

              Qt has to stay free or it will die.

              N 1 Reply Last reply
              1
              • aha_1980A aha_1980

                @nlfortier you need to properly set up the include paths in .includes and add predefined macros to .config

                Then it will work fine, probably even with Clang. I use it everyday in many projects.

                N Offline
                N Offline
                nlfortier
                wrote on last edited by
                #7

                @aha_1980 I have set up the .includes file and all directories containing the header files have been added, but the issues still persists. It cannot seem to find any included header files unless they are in the same directory as the source file.

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  nlfortier
                  wrote on last edited by
                  #8

                  I solved the issue. It turns out that I needed to add the absolute path for the root project directory to the includes file. Once I did, everything worked great.

                  aha_1980A 1 Reply Last reply
                  0
                  • N nlfortier

                    I solved the issue. It turns out that I needed to add the absolute path for the root project directory to the includes file. Once I did, everything worked great.

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @nlfortier ah, yes! I think you dont need the full path, but add a line with . which means current directory.

                    a bit annoying, but it works...

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    2

                    • Login

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