Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
#include <QDialog> - not found
I admit I'm hoping to be able to modify an old but useful Qt project by another author with minimal learning of Qt. (Based on using multiple IDEs over a 40-year career (as in downhill slide!) as programmer...)
So I'm using a recent download of Qt with MinGW. But Qt stops at line #include <QDialog>, saying that it is not found. This seems very fundamental but I cannot find any hint in documentation as to what I am missing out!
welcome to devnet
Presumably you downloaded and installed Qt 5. With Qt 5 already Qt 4 is an old Qt version. There are a couple of changes with Qt 5 versus Qt 4.
This "wiki article":http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5 might come in handy.
What IDE are you using?
Again another guess is that you are using Qt creator which is loading .pro files. Within the .pro file you need to declare the different modules with Qt +=... . Some of Qt's gui stuff has been shifted to widgets, which is probably your problem.
The first line is what I had to add to my Qt4 .pros when migrating to Qt5. The line keeps even the compatibility to Qt4.
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT += core
Thanks very much koahnig for that fast response. Editing my .pro file as you suggest has got me past that major stumbling point.
Perhaps I am going to have to read the article you cited to get past the "ui" complaints I now get...
Best wishes, Mike.
It depends all on your original application respectively on the original author. "ui" sounds a bit like auto-generated code of designer. It is typically stated at the beginning of the files respectively you can see with the file names. Those files reside in folders like "generatedFiles" and start with "ui_", "moc_" anothers. If this is the case, do yourself a favor and do not start to migrate those. Familiarize yourself a bit with designer.
[quote author="koahnig" date="1383125163"]It depends all on your original application respectively on the original author. "ui" sounds a bit like auto-generated code of designer. It is typically stated at the beginning of the files respectively you can see with the file names. Those files reside in folders like "generatedFiles" and start with "ui_", "moc_" anothers. If this is the case, do yourself a favor and do not start to migrate those. Familiarize yourself a bit with designer. [/quote]
Thank you again, but that does not get me very far. I looked at the Designer manual but of course that is all about how to use it, not about how it works!
I am happy with the original author's GUI design, which I can see is invested in six *.ui files which were in the zip file I downloaded and which open in Qt Creator and I hope do not require any explicit migration.
I can also see that the corresponding .cpp files have header files which in turn #include corresponding "ui_~~~~.h" files which I assume would be auto-generated from the .ui files in order to pass details of the GUI to the code. Similar mechanisms exist in other IDEs.
However no "ui_~~~~.h" files were in the zip file nor do they appear to have been generated by my Qt Creator 2.8.1. Yet I get no error messages saying that these #include references fail.
Regarding the line
@ Ui::AboutDialog ui;@
which generates an error, could it be that "Ui" was a (C++) namespace which existed in earlier versions of Qt but does not now? There is only one namespace explicitly defined in this code, and it is not "Ui".
If you just load the .pro file, all should be set up for using of designer and also for "uic'ing" of the designer files.
Sometimes it helps to restart "qmake" in Qt creator. Go to the left pane on "Projects". You should see a list will all modules and files nicely organized. Right click onto the project's name gives several options one is "Run qmake" and "rebuild" afterwards.
Ah, thank you, that made all the difference... Namely going from two errors about "UI::..." to 91 errors which are more specifically about declarations in a single code module, so easier to focus on!