Find the answer to your Linux question:
Results 1 to 10 of 10
I am new to GUI programming, while surfing through trolltech i find this tutorial. I tried several ways but couln't make it run. can somebody help please ??? Here is ...
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Location
    Rajshahi || Dhaka, Bangladesh
    Posts
    11

    Red face QT3 Problem

    I am new to GUI programming, while surfing through trolltech i find this tutorial. I tried several ways but couln't make it run. can somebody help please ???
    Here is the code :

    Code:
    
    /*
            A small program to demonstrate QT
            FileName : main.cpp
    */
    
    #include <qapplication.h>
    #include <qpushbutton.h>
    
    int main(int argc, char *argv[])
    {
            QApplication app(argc, argv) ; //application created
    
            QPushButton button1("hello world", 0) ; //button created params - caption, parent 0 for no parent
            button1.resize(100, 30) ; //resize params - width, height
            app.setMainWidget(&button1) ; //not necessary but every application should have a main widget
            button1.show() ; 
            return app.exec() ;
    }

    then i do the following
    qmake -project
    qmake
    make
    chmod +x main.o
    ./main.o

    the out come is this : "bash: ./main.o: cannot execute binary file"

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    main.o is just one of the binary files that make up your executable - it is NOT in itself an executable. The actual executable is either named a.out, or simply main. If the make files did not result in an executable, then you need to link the .o files with the appropriate libraries, such as qt, and create one.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Dec 2009
    Location
    Rajshahi || Dhaka, Bangladesh
    Posts
    11
    Thanx man. You r right. main.o is just a binary file. The thing that runs is another file named after me...! Now how weird is that ??? Do you have any explaination ???

  4. #4
    Just Joined! djap's Avatar
    Join Date
    Jul 2005
    Location
    Not so sure anymore...
    Posts
    97
    Quote Originally Posted by dumb_terminal View Post
    Thanx man. You r right. main.o is just a binary file. The thing that runs is another file named after me...! Now how weird is that ??? Do you have any explaination ???
    qmake -project names the project with the name of the directory it is in. So I suppose you had this file and you were running qmake in your home directory, which was named after you so the project was named after you and therefore the program itself was named after you.

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Of course it's kind of silly to have a program named "dumb_terminal"... ROFL
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Just Joined!
    Join Date
    Dec 2009
    Location
    Rajshahi || Dhaka, Bangladesh
    Posts
    11

    Talking

    Thanx to you all for your help.

    Quote Originally Posted by Rubberman View Post
    Of course it's kind of silly to have a program named "dumb_terminal"... ROFL
    I am really new to linux programming (7 and a half days) so have to learn a lot.

  7. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Of course, there are times when I think about chaning my handle to "dim_bulb"...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  8. #8
    Just Joined!
    Join Date
    Dec 2009
    Location
    Rajshahi || Dhaka, Bangladesh
    Posts
    11
    Quote Originally Posted by Rubberman View Post
    Of course, there are times when I think about chaning my handle to "dim_bulb"...
    I know this out of topic but let me ask are you making fun of me ? I don't mind though.

  9. #9
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by dumb_terminal View Post
    I know this out of topic but let me ask are you making fun of me ? I don't mind though.
    More making fun of myself and playing with names - dumb_terminal vs. dim_bulb...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  10. #10
    Just Joined!
    Join Date
    Dec 2009
    Location
    Rajshahi || Dhaka, Bangladesh
    Posts
    11
    Quote Originally Posted by Rubberman View Post
    More making fun of myself and playing with names - dumb_terminal vs. dim_bulb...
    Man you're one cool person. Next time i post a problem will look forward to your reply. Thanx for ur help again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...