Qt Creator can not find .h external file
-
!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.hppSOURCES +=
testdataaccess.cppwin32: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/ -ldataaccessINCLUDEPATH += $$PWD/../dataaccess
DEPENDPATH += $$PWD/../dataaccesswin32-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@ -
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.
-
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
-
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.
-
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 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
-
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.
-
Thank boy