Using Qt project code with earlier versions
-
Hi,
I was using Qt 5.2.1 for creating a Windows C++ .pro project. The application worked well. Then, i download The last Qt version 5.12.3 and i create a Qt Widgets application. I used my Qt 5.2.1 version code (.cpp file code, .h Header code, and .ui file code). However, i get a build errors as if the 5.12.3 version do not recognize the classes used in the code, and which was used correctly in the Qt 5.2.1 version. Is there a way to fix this ?
-
@aha_1980 Well my crystal ball tells me the op did not link the (presumably) copied header, source and ui files inside the new *pro file. But just made an include "xyzzy.h"
Prompting the error, as qmake failed to create the moc files for those classes.
-
-
you miss some header file - langue_button is not defined you should have something like
private: QPushButton *langue_button;
-
@arsinte_andrei langue_button is already declared in mainwindow.h and ui_mainwindow.h ! these files are already included.
-
Please post code as text, not as screenshot! It's impossible for me to copy relavant lines and comment on them.
That said, your .pro file looks overall sane, just the constructs at the beginning are redundand.
QT = core gui widgets
should be enough. Everything else untilTARGET
can be removed.The code errors come from the Clang Code Model, probably because it cannot find a header or has problems parsing a header. To investigate this problem, you should:
- Actually try to compile the project (Ctrl+B)
- Test if a new generated, simple project (form the wizards) works well.
If you don't want to invest much time in this, Clang Code Model can be disabled in Help > About Plugins > Clang Code Model.
Regards