LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 12-28-2005, 04:23 PM   #1
salscozzari
Member
 
Registered: Sep 2003
Posts: 36

Rep: Reputation: 15
qt3 beginning help


I bought a book C++ GUI Programming with QT3. I did the first program which of course is Hello. I ran qmake -project and then qmake hello.cpp. I ran the program and it worked as expected. I moved on to the next program, quit and did the same thing and when I run the program I get:

quit]$ ./quit.cpp
./quit.cpp: line 4: syntax error near unexpected token `('
./quit.cpp: line 4: `int main (int argc, char *argv[])'

I get the same thing now with 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();
}

I didn't add or remove any programs. I am running qt3 on PCLinuxOS and also am getting the same thing on Mandrake 2005 LE. It worked once and then the errors.

I sure would appreciate any help I can get.

Thanks,
Sal
 
Old 12-28-2005, 10:50 PM   #2
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
this
Quote:
moved on to the next program, quit and did the same thing and when I run the program I get:

quit]$ ./quit.cpp
./quit.cpp: line 4: syntax error near unexpected token `('
./quit.cpp: line 4: `int main (int argc, char *argv[])'
makes me wonder which file are you trying to execute here.. it looks to me like you are executing the cpp file ?

if i am reading it wrong, forgive me.. but if not.. you need to compile the source file and then run the executable that is produced..

 
Old 12-29-2005, 12:19 AM   #3
salscozzari
Member
 
Registered: Sep 2003
Posts: 36

Original Poster
Rep: Reputation: 15
Well thank you. I made a simple mistake and got so frustrated I couldn't see the forest from the trees. I tried to type ./hello and it said file not found so then I tried ./hello.cpp and got the errors. I was not typing make. Thank you for making me step back and finding my mistake.
 
Old 12-29-2005, 12:57 AM   #4
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45


yeh, i have been in the "forest for the trees" situation more times than i would like to admit...

good luck.
 
Old 12-30-2005, 10:09 PM   #5
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

http://www.linuxquestions.org/questi...d.php?t=397017
 
  


Closed Thread



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
Qt3.3 vs Qt 3.2 irfanhab Programming 0 05-11-2004 02:28 AM
qt3 samon Linux - General 3 01-28-2004 05:00 PM
About qt3... LI-6Y LUCY Programming 3 08-28-2003 09:45 AM
Help Qt3 Zion Linux - General 15 07-22-2002 06:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:18 AM.

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