1 Attachment(s)
Cannot use a existing Designer UI File in my application
I'm running Qt5.0.0 msvc2010 and I'm trying to add 3 files to a very basic project using the "add existing files" option of Qt Creator. The only intent of this project is to display a window created with Qt Designer.
The 3 files are mainwindow.h, mainwindow.cpp and mainwindow.ui automatically generated by Qt Designer.
When I try to compile, I get this: fatal error C1083: Cannot open include file: 'mainwindow.h': No such file or directory.
The files are correctly located in my projet file and qmake runs fine.
Code:
QT += widgets
SOURCES += \
main.cpp \
../test/mainwindow_test_form/mainwindow.cpp[ATTACH=CONFIG]8718[/ATTACH]
FORMS += \
../test/mainwindow_test_form/mainwindow.ui
HEADERS += \
../test/mainwindow_test_form/mainwindow.h
My main.cpp files look like this:
Code:
#include <QApplication>
#include <QtGui>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
MainWindow theMainWindow;
theMainWindow.show();
return app.exec();
}
I tried to put the 3 files in different locations (in or out of the project) and I still get the same result.
Any Suggestions?
Thanks!
I have attached a screenshot of my project in Qt Creator too. It might help.
Re: Cannot use a existing Designer UI File in my application
#include "mainwindow.h" ==> #include "../test/mainwindow_test_form/mainwindow.h"
Re: Cannot use a existing Designer UI File in my application
Or you can simply add
Code:
INCLUDEPATH += ../test/mainwindow_test_form
to the pro file.
Re: Cannot use a existing Designer UI File in my application
Thank to both of you! I tried both approachs and they work.
I prefer Lykurg'a approach though. If the files change location later, I'll just have to update the path in one place.