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 can not find .h external file

Qt Creator can not find .h external file

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.2k 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.
  • E Offline
    E Offline
    Exotic_Devel
    wrote on last edited by
    #1

    !http://i60.tinypic.com/28iqpes.png(Screen)!

    My project is divided into subdirs, I created a subdir to test a unit. But Creator does not find the file h, added to the project.

    My .pro

    @HEADERS +=
    testdataaccess.hpp
    ../dataaccess/dataaccess.hpp

    SOURCES +=
    testdataaccess.cpp

    win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../dataaccess/release/ -ldataaccess
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../dataaccess/debug/ -ldataaccess
    else:unix: LIBS += -L$$OUT_PWD/../dataaccess/ -ldataaccess

    INCLUDEPATH += $$PWD/../dataaccess
    DEPENDPATH += $$PWD/../dataaccess

    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../dataaccess/release/libdataaccess.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../dataaccess/debug/libdataaccess.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../dataaccess/release/dataaccess.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../dataaccess/debug/dataaccess.lib
    else:unix: PRE_TARGETDEPS += $$OUT_PWD/../dataaccess/libdataaccess.a@

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      If there is some external header file, path needs to included in .pro file using INCLUDEPATH. Hope it contains the right directory where header files exist.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Exotic_Devel
        wrote on last edited by
        #3

        I think I've included, see the line:

        @INCLUDEPATH += $$PWD/../dataaccess@

        In the picture you can see that the dataaccess file is in the tree

        1 Reply Last reply
        0
        • E Offline
          E Offline
          Exotic_Devel
          wrote on last edited by
          #4

          I believe this is a bug of the Creator. After reading your reply I opened the Creator and the error no longer occurs. Nothing was done before that, I turned off the machine and went to lunch.
          This already happened to me on other projects.

          Here is another "topic":http://qt-project.org/forums/viewthread/43810/ where i report the same problem.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            ambershark
            wrote on last edited by
            #5

            It's not a bug, you just didn't run qmake when you changed the pro file. This happens to a lot of people when they use qt creator.

            Just make sure you go Build->Run qmake any time you change your pro file and that should take care of it.

            Also you don't need $$PWD, all paths would be relative to the current directory so ./../dataaccess would work as would just plain ../dataaccess.

            When things are acting weird sometimes it's good to just make clean / qmake / make. Usually fixes the problem. :)

            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

            1 Reply Last reply
            0
            • E Offline
              E Offline
              Exotic_Devel
              wrote on last edited by
              #6

              [quote author="ambershark" date="1406233706"]It's not a bug, you just didn't run qmake when you changed the pro file. This happens to a lot of people when they use qt creator.

              Just make sure you go Build->Run qmake any time you change your pro file and that should take care of it.

              Also you don't need $$PWD, all paths would be relative to the current directory so ./../dataaccess would work as would just plain ../dataaccess.

              When things are acting weird sometimes it's good to just make clean / qmake / make. Usually fixes the problem. :)
              [/quote]

              This .pro file was generated by Creator

              1 Reply Last reply
              0
              • A Offline
                A Offline
                ambershark
                wrote on last edited by
                #7

                Ah ok, so they like to use $$PWD, I was just going to save you some typing if you did those manually.

                Either way, just run qmake in the future and it will resolve those types of issues. It should resolve the issue you saw in the other topic you posted as well. At least in my experience.

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  Exotic_Devel
                  wrote on last edited by
                  #8

                  Thank boy

                  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