I created a very simple project in QT creator, *.pro file is just following:
HEADERS += inc\1.h
SOURCES += src\1.cpp
Here is the source code:
// 1.h
const int C = 1;
// 1.cpp
#include "1.h"
int main() {
return C;
}
QT Creator successfully opens this "project", but cannot parse it. F2 does not work for C constant, 1.h header cannot be found.
Please look at the screenshot which describes the problem:
The most strange part is that exactly the same thing seems to work on my other machine with similar QT SDK 5.0 installation! Could you please advise where am I wrong?
HEADERS
is supposed to list the header files of your own project, just like SOURCES
lists the source files.
If you want to include external header files, you should add their folders to INCLUDEPATH
instead:
INCLUDEPATH += inc
The following .pro file works perfectly in Qt Creator 2.5.0, Qt 4.6.1:
QT += core
QT -= gui
TARGET = test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += \
src/1.cpp
INCLUDEPATH += inc
Try that exact .pro file, give it 3 seconds to parse and tell me if it worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With