Results 1 to 15 of 15

Thread: QT Console app

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QT Console app

    try it straight c++, and if you are on windows make sure you have this line: CONFIG += console in your project file
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. //QCoreApplication a(argc, argv);
    4.  
    5. CClient client;
    6.  
    7. client.create();
    8.  
    9. std::cout << "input a number (-1 to quit) " << std::endl;
    10.  
    11. int nRetVal = 0;
    12. std::string buffer;
    13.  
    14. while (std::getline(std::cin, buffer)) // Where do I enter text within the console app??
    15. {
    16. if (buffer.compare("-1") == 0)
    17. {
    18. break;
    19. }
    20. client.Send(buffer.c_str());
    21. nRetVal = client.Recieve();
    22.  
    23. std::cout << "Received " << nRetVal << " from server." << std::endl << std::endl;
    24.  
    25. std::cout << "input a number (-1 to quit) ";*/
    26. }
    27. std::cout << "Client says bye bye!!" << std::endl;
    28. //return a.exec();
    29. return 0;
    30. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jun 2010
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QT Console app

    Already tried that and my .pro file has CONFIG+=console.

    Where do you enter text within the QT IDE for console apps?

  3. #3
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QT Console app

    Quote Originally Posted by yorkshireflatcap View Post
    Where do you enter text within the QT IDE for console apps?
    Go in the "Project" part on the left of QtCreator and then in the "Run Settings" tab, click on Show Details button, and there is a Arguments line edit. (I think this is what you meant by that question, sorry if i misunderstood)

    Anyway, my opinion is that your problem has nothing to do with arguments, it's somewhere else in the code, so use the debugger and see where your code fails.
    Last edited by Zlatomir; 22nd June 2010 at 09:38.

  4. #4
    Join Date
    Jun 2010
    Location
    France
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: QT Console app

    Hi there!

    I think I understand your problem.

    Go to Project (left menu) then go to "Run Settings"

    There should be a checkbox named "Run in terminal", just check it.

    I've tested this in Qt Creator 1.3, and it works =)
    Last edited by fezvez; 22nd June 2010 at 13:25.

  5. The following user says thank you to fezvez for this useful post:

    yorkshireflatcap (22nd June 2010)

  6. #5
    Join Date
    Jun 2010
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Thumbs up Re: QT Console app

    Thats it!! Thanks Fezvez... Thats worked a charm!!!!!
    Regards

    John
    Last edited by yorkshireflatcap; 22nd June 2010 at 21:01.

Similar Threads

  1. about console application
    By jirach_gag in forum Qt Programming
    Replies: 2
    Last Post: 5th January 2012, 11:39
  2. Console window?
    By waynew in forum Qt Programming
    Replies: 6
    Last Post: 22nd April 2010, 22:27
  3. No information on the console
    By starcontrol in forum Qt Programming
    Replies: 1
    Last Post: 8th April 2008, 13:39
  4. No console output in Mac OSX using Qt4
    By popoholic in forum Qt Programming
    Replies: 2
    Last Post: 26th September 2006, 01:36
  5. QT4 console apps
    By ucntcme in forum Newbie
    Replies: 5
    Last Post: 24th January 2006, 10:18

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
  •  
Qt is a trademark of The Qt Company.