Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt 5 build error: extra characters after test expression

Tags:

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.

like image 967
Sham Avatar asked Jul 27 '14 12:07

Sham


1 Answers

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.

like image 77
mjk99 Avatar answered Sep 20 '22 20:09

mjk99