I am trying to learn Qt 5.3, and this is my first program (hello world). When I try to build, it displays this error:
extra characters after test expression.
I cannot understand at all why this error comes up. I just took some simple code from the Internet to check whether I have installed Qt properly or not. Here is the code:
#include <QApplication> #include <QPushButton> int main(int argc, char **argv) { QApplication app (argc, argv); QPushButton button ("Hello world !"); button.show(); return app.exec(); }
The error is displayed in lines 3, 5, 6, 8. I am completely new to Qt, so please give a simple explanation.
Check the .pro file. Sometimes it's because you don't have a blackslash at the end of one of the lines that isn't last:
HEADERS += Qt/mainwindow.h \ Qt/MPrintableWidget.h \ Qt/MPrintableWidgetGroup.h # Oooops forgot the \ here Qt/MFixedSizeDialog.h \ Qt/MScreenPage.h
Every line here except the bottom one needs to end in a backslash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With