another QT3 problem
I am trying to learn some programming with QT3. I have the book C++ GUI Programming with QT3. I did the first program "hello" and the first time I ran it everything worked as expected but now I get:
[dad@localhost hello]$ ./hello.cpp ./hello.cpp: line 3: syntax error near unexpected token `(' ./hello.cpp: line 3: `int main (int argc, char *argv[])' I didn't do anything to the program and now I also get this with the next simple program called quit. Hello: #include <qapplication.h> #include <qlabel.h> int main (int argc, char *argv[]) { QApplication app(argc, argv); QLabel *label = new QLabel("Hello Qt!", 0); app.setMainWidget(label); label->show(); return app.exec(); } Quit: #include <qapplication.h> #include <qpushbutton.h> int main (int argc, char *argv[]) { QApplication app(argc, argv); QPushButton *button = new QPushButton("Quit", 0); QObject::connect(button, SIGNAL(clicked()), &app, SLOT(quit())); app.setMainWidget(button); button->show(); return app.exec(); } [dad@localhost quit]$ ./quit.cpp ./quit.cpp: line 4: syntax error near unexpected token `(' ./quit.cpp: line 4: `int main (int argc, char *argv[])' The thing that gets me is it worked once and now I get these errors. I sure would appreciate any help. Thanks, Sal |
the only thing i can think of is these files have been on a ms computer ?
and that ms newline think is confusing the compiler |
No they have not been on an MS machine. I even deleted the files and started from scratch. Same result
|
Why are you trying to run the source file? :/
|
Because the second time I ran it I had deleted all the files and redid the hello.cpp. then I typed "qmake -project", then "qmake hello.cpp" and then DID NOT type "make" so typing ./hello produced nothing. Typing ./hello.cpp at least gave me something. Thanks for helping me find my mistake. It works great when you make the executable.
|
All times are GMT -5. The time now is 06:30 PM. |