PDA

View Full Version : Qt Creator Not Recognizing my own header file.



Plissken
18th July 2012, 06:46
My .pri file called widgets.pri:
SOURCES += \
internal_lib/widgets/sheet_wp.cpp

HEADERS += \
internal_lib/widgets/sheet_wp.h

My .pro file has this include:
include(internal_lib/widgets/widgets.pri)

Everything was working fine but suddenly I get the following error:
error: C1083: Cannot open include file: 'internal_lib/widgets/sheet_wp.h': No such file or directory

wysota
18th July 2012, 06:49
You probably need a proper INCLUDEPATH as well. Or even that and also DEPENDPATH.

Plissken
18th July 2012, 06:54
Yes, those are there but still not recognizing them:

INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD

Edit: Odd. I've removed the files and even added (existing) files, so that the .pri file does its auto stuff, it still doesn't recognize only that file (I have other files that are recognized fine).

wysota
18th July 2012, 08:10
How are you including the file in your sourcecode?

Plissken
18th July 2012, 08:48
#include "internal_lib/widgets/sheet_wp.h"

wysota
18th July 2012, 09:36
How about this:

INCLUDEPATH += internal_lib/widgets

and then:


#include "sheet_wp.h"

Does it change anything?

Plissken
18th July 2012, 23:47
No, it doesn't. Same error message. This project folder I had cloned from a git repository. I wonder if that has anything to do with it? When I open the .pro file for the first time, it asked whether I wanted to load the .user setting files (but it recommends that I don't) so I just clicked no.

The weird thing is that the code compiles fine on the computer that this project was originally created on.

wysota
19th July 2012, 09:28
Can we see the actual compiler invokation that fails?

Plissken
19th July 2012, 21:26
error: C1083: Cannot open include file: 'internal_lib/widgets/sheet_wp.h': No such file or directory

amleto
19th July 2012, 23:00
compiler command, not error

Plissken
20th July 2012, 07:03
I got this working. I don't know the exactly why it got it working, but I was reading the definition of PWD in the Qt Docs and a word that caught my eye in the definition was shadow build. I realized in the original project which did compile correctly was using shadow building, but the same project I loaded on a different computer was not using shadow building. Once I enabled shadow building (and this must be done when the pro file is loaded for the first time, not later on) it started compiling without errors. Thanks wysotta for your help.