Sunday, July 6th 2008, 2:21pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

eng16danbo

Beginner

Posts: 3

Location: Japan,Tokyo Hachioji-city

Occupation: Software Engineer

1

Tuesday, April 29th 2008, 12:28pm

Compile Error

I installed Qt today.
I run Ubuntu7.10 and with 4.3.2 version of Qt.
When I described following code,I got following error messages.

<source code>
//Hello.cpp
1 #include <QApplication>
2 #include <QLabel>
3
4 int main (int argc,char *argv[])
5 {
6 Qapplication app(argc, argv);
7 Qlabel label = new Qlabel("Hello,Qt!");
8 label->show();
9 return app.exec();
10 }
11


<error message>
Hello.cpp:4: Unknown test function: int main
Hello.cpp:6: Unknown test function: QApplication app
Hello.cpp:6: Parse Error ('QApplication app(argc, argv);')
Error processing project file:

Simply Idon't solve either installation mistake or coding error.
Would you help me?
Thanks.

This post has been edited 2 times, last edit by "eng16danbo" (Apr 29th 2008, 12:31pm)

  • Go to the top of the page

kunalnandi

Beginner

Posts: 18

Location: India

Occupation: Programmer

2

Tuesday, April 29th 2008, 1:31pm

RE: Compile Error

Hello,

jst check ur .pro file, make sure that u hv included Hello.cpp into tht.
Regards
Kunal Nandi
  • Go to the top of the page

eng16danbo

Beginner

Posts: 3

Location: Japan,Tokyo Hachioji-city

Occupation: Software Engineer

3

Tuesday, April 29th 2008, 1:51pm

>kunalnandi
Thank you for your response.
well...
I described following description in in .profile when I installed Qt.

<description in .profile>
QTDIR=/usr/local/qt
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

export QTDIR PATH MANPATH LD_LIBRARY_PATH
<description in .profile>

Are other setting needed when compiling?

Thanks.
  • Go to the top of the page

kunalnandi

Beginner

Posts: 18

Location: India

Occupation: Programmer

4

Wednesday, April 30th 2008, 5:38am

RE: Compile Error

Quoted

Originally posted by eng16danbo
I installed Qt today.
I run Ubuntu7.10 and with 4.3.2 version of Qt.
When I described following code,I got following error messages.

<source code>
//Hello.cpp
1 #include <QApplication>
2 #include <QLabel>
3
4 int main (int argc,char *argv[])
5 {
6 Qapplication app(argc, argv);
7 Qlabel label = new Qlabel("Hello,Qt!");
8 label->show();
9 return app.exec();
10 }
11


<error message>
Hello.cpp:4: Unknown test function: int main
Hello.cpp:6: Unknown test function: QApplication app
Hello.cpp:6: Parse Error ('QApplication app(argc, argv);')
Error processing project file:

Simply Idon't solve either installation mistake or coding error.
Would you help me?
Thanks.


Hello,

jst have a look below.. u have done some silly mistakes.. :) no worries dear....
Compare your code with this code.. its not installation mistake its coding error..

#include <QApplication>
#include <QLabel>

int main (int argc,char *argv[])
{
QApplication app(argc, argv);

QLabel *label = new QLabel("Hello,Qt!"); // or QLabel label( "Hello, Qt!");
label->show(); // label.show();

return app.exec();
}

this was abt ur "Hello.cpp"

now execute following commandas..
shell$ qmake -project // this will create a .pro file.
shell$ qmake // this will create MakeFile.
shell$ make // this will compile ur code and generate executable file.
shell$ ./generatedExe // this will show the output.
Regards
Kunal Nandi
  • Go to the top of the page

eng16danbo

Beginner

Posts: 3

Location: Japan,Tokyo Hachioji-city

Occupation: Software Engineer

5

Saturday, May 3rd 2008, 11:02am

RE: Compile Error

Dear kunalnandi

Hi.
I succeeded in compiling thanks to your advice!
Although I run Ubuntu7.10 and with 4.3.2 version of Qt,I installed openSUSE 10.3 in my machine,and I installed qt version 4.3.1.
Thanks to your advice,I could compile compile my source.

Thanks! :)
  • Go to the top of the page

Rate this thread