Results 1 to 7 of 7

Thread: Writing a Qt console application

  1. #1
    Join Date
    Nov 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Writing a Qt console application

    Hi, this is my first post here,

    My question is about console apps, when I start a new console application project in Qt Creator I get a main function like this:

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    printf("Hello world!");

    return a.exec();
    }

    and when I run the app, it never exits. It seems to hang at a.exec(). What's happening?

  2. #2
    Join Date
    Sep 2009
    Posts
    20
    Thanked 2 Times in 2 Posts

    Default Re: Writing a Qt console application


  3. #3
    Join Date
    Nov 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Writing a Qt console application

    Hi,

    Thanks for the reply. But should I use the "return a.exec()" statement, or should I just change it to "return 0"? The link you provided says a.exec() is used to enable event handling, so I guess I don't really need it, because my program is a console app, so I have no GUI and don't need event handling.

    Can you point me to a good tuturial for writing a console app with Qt Creator?

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Writing a Qt console application

    i think qt creator comes with a new project wizard which generates a skeleton appliction for console

  5. #5
    Join Date
    Feb 2011
    Posts
    1
    Qt products
    Platforms
    Symbian S60

    Default creative-writers.net

    Writing a proposal can be a tedious job but if you know the steps, it will be simple. Proposal reason is to convey information and must instill a favorable attitude toward that information and toward the company communicating it.

  6. #6
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Writing a Qt console application

    Quote Originally Posted by sashoalm View Post
    Thanks for the reply. But should I use the "return a.exec()" statement, or should I just change it to "return 0"?
    Just change it to "return 0;" and It should work. Look at that thread: http://www.qtcentre.org/threads/3620...-order-of-code. I had the same problem.

    best regards
    Tomasz

  7. #7
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: creative-writers.net

    Quote Originally Posted by Mudali View Post
    Writing a proposal can be a tedious job but if you know the steps, it will be simple. Proposal reason is to convey information and must instill a favorable attitude toward that information and toward the company communicating it.
    Are you a bot?

Similar Threads

  1. Replies: 8
    Last Post: 28th January 2015, 09:45
  2. Debugging a console application
    By Lorthirk in forum Qt Tools
    Replies: 1
    Last Post: 26th September 2009, 11:49
  3. Exiting a Qt Console Application
    By nbetcher in forum Qt Programming
    Replies: 4
    Last Post: 23rd March 2009, 21:03
  4. libGL using memory in console application
    By neuron in forum Qt Programming
    Replies: 0
    Last Post: 11th March 2009, 15:52
  5. build a gui ontop of a console application
    By aegis in forum Qt Programming
    Replies: 3
    Last Post: 25th March 2007, 12:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.