Solved Problem with "C++ GUI Programming with Qt4, 2nd Edition"
-
Hi
Incomplete type often means you forgot the include. ( like #include <QLabel> )
But in this case please check you have
QT += widgets
in the .pro filealso go to
https://github.com/mutse/qt5-book-code
and see if he fixed sample for Qt5 -
The thing is it's not my files. It's book example. Literally took it from the site to compare with my code. So i don't think it's about me forgetting something.
Yep, it's there.
Ok, i'll check it now.
-
Hi
What chapter is it ?Ag Chap02, find.pro
-
@LonelyZero said in Problem with "C++ GUI Programming with Qt4, 2nd Edition":
I thought linked files may say much more than my noobie analysis.
I did not say you should analyze the problem, but you need to give us facts for our analysis. Compiler errors often differ from compiler to compiler and from platform to platform, so it is needed to see what's going wrong on your side.
I don't think there is a way to copy error log
Just go to the compile output pane and you can select the whole compiler log.
and i'm kinda too stupid to feel the difference between linker errors and runtime errors.
Oh. How is your C++ knowledge level? You will need C++ to work with Qt.
-
Version from github works. Now just need to find the difference. Probably can do it myself.
-
@LonelyZero
I like to use
http://winmerge.org/
for such tasks.update:
for learning
I had to change forwards to includesclass QCheckBox;
class QLabel;
class QLineEdit;
class QPushButton;#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <qcheckbox.h>and add
#include <QHBoxLayout> to .cpp
it seems that #include <QtGui>
used to pull in more.and QT +=widgets
to .proso basically you can fix it with replace
#include <QtGui> with
#include <QtWidgets>
but NOTE , this is not good style for real projects as it pulls in far more than you need :) -
I know basic C++ stuff. Functions, variables, classes. I don't feel like i don't understand the code i've seen so far. It's just all i knew is from couple books i read in free time and i have zero expirience with real software and, erm, error fixing. That's kinda stuff i'm used to. It's for university so don't worry i'm not gonna crash any planes.
-
Thank you! I'll try that one in couple hours.
-
@LonelyZero said in Problem with "C++ GUI Programming with Qt4, 2nd Edition":
I know basic C++ stuff. Functions, variables, classes. I don't feel like i don't understand the code i've seen so far. It's just all i knew is from couple books i read in free time and i have zero expirience with real software and, erm, error fixing.
Then just start coding :) You will get used to error fixing if you do errors, and you will learn a lot. When I started coding, I typed listings from books and so you had to fix lots of errors before the program was running the first time. But you also got a better understanding of the code you're having.
That's kinda stuff i'm used to. It's for university so don't worry i'm not gonna crash any planes.
:) But if you need help building your first plane, just ask here.
-
Yep, changed forwards into includes and added layout to .cpp. Works perfectly. Thank you, guys.