Iching Chang
Iching Chang

Reputation: 658

Qt Creator does not recognize the my change in the pro. file

When I include something in Qt Creator, later I find out that that include does not exist, I want to correct that mistake by using a right path, or just deleting the include. But, that did not work, even if I delete the wrong include, but Qt Creator still try to find that include in the next build/run. I have already try to rebuild/clean the project but that does not work either. The only solution was to create a new project, or place the included file in that "wrong" place. I thought this question should not be a difficult one. But I fail to solve it.

for example, this is my pro. file.

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = simpleStitch
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

INCLUDEPATH += C:\opencv249\build\includes

LIBS += C:\opencv249\build\x64\vc12\lib\opencv_core249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_highgui249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_features2d249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_imgproc249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_stitcher249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_calib3d249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_nonfree249.lib

I have make a mistake in the LIBS += C:\opencv249\build\x64\vc12\lib\opencv_stitcher249.lib. the right one should be stitching249.lib. after I correct it to be stitching249.lib. the qt still try to find the C:\opencv249\build\x64\vc12\lib\opencv_stitcher249.lib. it is pretty strange. qt does not recognize my change in the pro. file even if I use the clean/ rebuild.

Upvotes: 1

Views: 2554

Answers (2)

AngryDuck
AngryDuck

Reputation: 4607

Run qmake? if you make changes to the .pro file then you need to qmake again or it will just be building against whatever is there from your last qmake

Upvotes: 5

goGud
goGud

Reputation: 4333

Please give more information, so that we can understand specific problem. Here is what you need to do before starting a new project.

To add kits, select Tools > Options > Build & Run > Kits > Add.

Each kit consists of a set of values that define one environment, such as a device, compiler, and Qt version. If you know you have installed a Qt version, but it is not listed in Tools > Options > Build & Run > Qt Versions, you must add it.

Also check that your compiler is listed in Tools > Options > Build & Run > Compilers.

And also you should modify your .pro file in order to your settings. Here is one of my project's .pro file. You can modified it yourself...

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = myTarget
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui


INCLUDEPATH += /usr/local/include/opencv

LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_ml \
-lopencv_video \
-lopencv_features2d \
-lopencv_calib3d \
-lopencv_objdetect \
-lopencv_contrib \
-lopencv_legacy \
-lopencv_flann

Then, in your code you need to include which libraries you want to use.. Such as:

#include <QMainWindow>
#include <opencv/cv.h>
#include <opencv/highgui.h>

I have never used Windows. As I know in windows symbol \ occurs problem if you not use 2 of them. Here is an example to understand clearly..

   INCLUDEPATH += D:\\ProgrammingTools\\opencv\\build\\include

CONFIG( debug, debug|release ) {
LIBS += -LD:\\ProgrammingTools\\opencv\\build\\x86\\vc10\\lib\
    -lopencv_core246d\
    -lopencv_highgui246d\
    -lopencv_imgproc246d\
    -lopencv_features2d246d\
}
else {
LIBS += -LD:\\ProgrammingTools\\opencv\\build\\x86\\vc10\\lib\
    -lopencv_core246\
    -lopencv_highgui246\
    -lopencv_imgproc246\
    -lopencv_features2d246\
}

Upvotes: -1

Related Questions