Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-27-2005, 08:00 PM   #1
Registered: Sep 2003
Posts: 36

Rep: Reputation: 15
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.


#include <qapplication.h>
#include <qlabel.h>
int main (int argc, char *argv[])
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!", 0);
return app.exec();

#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()));
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.

Old 12-27-2005, 11:07 PM   #2
Senior Member
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 52
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
Old 12-28-2005, 09:01 PM   #3
Registered: Sep 2003
Posts: 36

Original Poster
Rep: Reputation: 15
No they have not been on an MS machine. I even deleted the files and started from scratch. Same result
Old 12-28-2005, 11:41 PM   #4
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Why are you trying to run the source file? :/
Old 12-29-2005, 12:22 AM   #5
Registered: Sep 2003
Posts: 36

Original Poster
Rep: Reputation: 15
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Qt3 SpEcIeS SUSE / openSUSE 3 04-22-2005 06:28 PM
Problem installing qt3.3.2 Brummy Linux - Software 2 08-14-2004 10:46 AM
Qt3.3 vs Qt 3.2 irfanhab Programming 0 05-11-2004 02:28 AM
QT3 designer problem tux89 Programming 1 03-20-2004 10:33 AM
QT3 Problem when compiling a program PaladinCowboy75 Linux - Software 0 10-23-2002 09:53 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:38 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration