Friday, July 4th 2008, 9:49pm UTC+1

You are not logged in.

  • Login
  • Register

1

Wednesday, February 6th 2008, 3:18pm

Not able to run my application !

Hello! Guys,

I am new to Qt GUI Design. Recently i tried to do a small and simple project in which i developed metric.pro file, main.cpp file & form.h file. After all this i used qmake command to create makefile and then make to create its executable.Ya i am working on linux.

But the main problem is whenever i try to run my application i am not able to run my application.
Its showing me "command not found error".

Can anyone please help me out in this stuff. I will be obliged if helped please.....

Thanks in Advance.

:-------:--------:-------:---------:----------:------------:-------:

I am glad to join qtforum wherein i can get to see so many helpful issues.

This post has been edited 2 times, last edit by "Krish" (Feb 8th 2008, 12:42pm)

  • Go to the top of the page

SiRuS

Beginner

Posts: 8

Location: none

Occupation: none

2

Tuesday, February 12th 2008, 12:25pm

RE: Not able to run my application !

try this

Source code

1
2
chmod +x programm_name  //make you file executable
./programm_name //run you programm

and read about linux =)
  • Go to the top of the page

3

Tuesday, February 12th 2008, 3:39pm

RE: Not able to run my application !

Thanks Sirus ! Just see below is the output screen of the terminal, wherein even you can see it is i.e. "metric" file is executable.

drwxrwx--- 2 abcdxyz 80 Feb 8 11:34 .moc
drwxrwx--- 2 abcdxyz 1024 Feb 11 14:41 .obj
drwxrwx--- 2 abcdxyz 1024 Feb 11 14:41 .ui
-rw-rw---- 1 abcdxyz 4074 Feb 11 14:41 Makefile
-rw-rw---- 1 abcdxyz 12250 Feb 8 15:39 conversionform.ui
-rw-rw---- 1 abcdxyz 2037 Feb 8 11:31 conversionform.ui.h
-rw-rw---- 1 abcdxyz 12339 Feb 8 15:39 conversionform.ui~
drwxrwx--- 2 abcdxyz 80 Feb 8 15:38 images
-rw-rw---- 1 abcdxyz 256 Feb 8 11:32 main.cpp
-rwxrwx--- 1 abcdxyz 307243 Feb 11 15:09 metric
-rw-rw---- 1 abcdxyz 206 Feb 8 15:39 metric.pro

But whenever i try to run "metric" it says "command not found" i dont know why! For informing i am working on linux with Qt3.1.2 version. Please help me buddy.

I will be obliged------>Thanks in advance.

This post has been edited 3 times, last edit by "Krish" (Feb 13th 2008, 10:25am)

  • Go to the top of the page

4

Wednesday, February 13th 2008, 5:52am

RE: Not able to run my application !

Post the command your r executing to run the application.......

Also, write the code of each file............
  • Go to the top of the page

5

Wednesday, February 13th 2008, 9:58am

RE: Not able to run my application !

Thanks Bargi !
The command which i used to run my application is: - first i went to directory where my project file is i.e. Convert & then i used "qmake -o Makefile metric.pro". Then i used "make" command to get its executable. Finally i used "metric" to run the application.

Below is the output screen of the terminal: -

abcdxyz:~:(1)> cd Convert
abcdxyz:~/Convert:(2)> qmake -o Makefile metric.pro
abcdxyz:~/Convert:(3)> make
g++ -o metric .obj/main.o .obj/conversionform.o .obj/qmake_image_collection.o .obj/moc_conversionform.o -L/usr/lib64/qt-3.1/lib -L/usr/X11R6/lib64 -lqt-mt -lXext -lX11 -lm
abcdxyz:~/Convert:(4)> metric
metric: Command not found.
abcdxyz:~/Convert:(5)> ./metric
metric: cannot connect to X server
:-----------:---------Conversionform.ui.h------------:-----------:
void ConversionForm::convert()
{
enum MetricUnits {
Kilometers,
Meters,
Centimeters,
Millimeters
};
enum OldUnits {
Miles,
Yards,
Feet,
Inches
};

// Retrieve the input
double input = numberLineEdit->text().toDouble();
double scaledInput = input;

// internally convert the input to millimeters
switch ( fromComboBox->currentItem() ) {
case Kilometers:
scaledInput *= 1000000;
break;
case Meters:
scaledInput *= 1000;
break;
case Centimeters:
scaledInput *= 10;
break;
}

//convert to inches
double result = scaledInput * 0.0393701;

switch ( toComboBox->currentItem() ) {
case Miles:
result /= 63360;
break;
case Yards:
result /= 36;
break;
case Feet:
result /= 12;
break;
}

// set the result
int decimals = decimalsSpinBox->value();
resultLineEdit->setText( QString::number( result, 'f', decimals ) );
numberLineEdit->setText( QString::number( input, 'f', decimals ) );
}

#include <qvalidator.h>

void ConversionForm::init()
{
numberLineEdit->setValidator( new QDoubleValidator( numberLineEdit ) );
numberLineEdit->setText( "10" );
convert();
numberLineEdit->selectAll();
:--------------:---------End of file--------------:--------------:

:--------------:--------main.cpp-----------:--------------:

#include <qapplication.h>
#include "conversionform.h"

int main( int argc, char ** argv )
{
QApplication a( argc, argv );
ConversionForm w;
w.show();
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
}
:-------------:--------End of file---------:--------------:

Thanks in advance for helping me out.

This post has been edited 1 times, last edit by "Krish" (Feb 13th 2008, 10:25am)

  • Go to the top of the page

SiRuS

Beginner

Posts: 8

Location: none

Occupation: none

6

Wednesday, February 13th 2008, 11:51am

RE: Not able to run my application !

Quoted

Originally posted by Krish
abcdxyz:~/Convert:(5)> ./metric
metric: cannot connect to X server
You need X server to run your program.
  • Go to the top of the page

7

Thursday, February 14th 2008, 9:59am

RE: Not able to run my application !

try with this my demo
after downloading and unziping rum after them run qmake, make
http://www.qtforum.org/attachment.php?attachmentid=1524
  • Go to the top of the page

8

Friday, February 15th 2008, 7:41am

RE: Not able to run my application !

Hmm..there may be error in Xserver.......

Try this command:

Quoted


echo $DISPLAY


If it results in ":0.0" then it is ok....else you have set environment variable:

Quoted


$ export DISPLAY=:0.0


try this and restart your application.
  • Go to the top of the page

9

Friday, February 15th 2008, 9:43am

RE: Not able to run my application !

Hello! Bargi,
Thanks buddy it worked but i still have a problem.

I have Linux & Windows on my system wherein i have installed Qt in Linux. As far as i know the developed application is platform independent & should work in any platform but my application works only in Linux. The executable doesn't work in Windows. Also in Windows even the file is not shown as executable. Why is it so? Please help me out in this stuff.

I will be obliged if helped. Thanks cery much in advance.

This post has been edited 1 times, last edit by "Krish" (Feb 15th 2008, 9:44am)

  • Go to the top of the page

macabre13

Trainee

Posts: 127

Location: Poland/ Wroclaw

Occupation: sw developer

10

Friday, February 15th 2008, 10:09am

RTFM ;)

That compatibility is introduced in windows vista with .net 3.5, and if you using a dialogs in yours app it won't work with xp sp1. Also check that you have latest monitor driver.
- ebm - noise - industrial -
I always could be wrong.
Lets share knowledge!

This post has been edited 1 times, last edit by "macabre13" (Feb 15th 2008, 10:13am)

  • Go to the top of the page

11

Friday, February 15th 2008, 10:13am

Hello! Macahre.

Thanks for replying but my friend i didn't get you ! What is RTFM!!!!!!!

And ya i have Windows Server 2003 on my PC. So as per you is it like all my applications wont work on it? & will only work on Vista??????

Thanks again in advance for answering.

This post has been edited 1 times, last edit by "Krish" (Feb 15th 2008, 10:16am)

  • Go to the top of the page

12

Friday, February 15th 2008, 12:15pm

Rtfm

RTFM mean ........"Read The Fucking Manual" :)

You shuld go through QT manual for this............
  • Go to the top of the page

Rate this thread