Results 1 to 10 of 10

Thread: Qt Creator Plain C++ Project won't run/debug...

  1. #1
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Qt Creator Plain C++ Project won't run/debug...

    Hi, all:

    Environment:
    OS: Ubuntu 12.04
    Qt: Qt Creator 2.4.1
    Based on Qt 4.8.0 (32 bit)

    Built on Mar 21 2012 at 23:05:03


    As titled:
    After having created a plain C++ project, with a default Hello World in main.cpp
    Qt Code:
    1. #include <iostream>
    2.  
    3. using namespace std;
    4.  
    5. int main()
    6. {
    7. cout << "Hello World!" << endl;
    8. return 0;
    9. }
    To copy to clipboard, switch view to plain text mode 

    It's so strange that I'm not able to debug/run this application after building.
    The .pro file is as simple as:
    Qt Code:
    1. TEMPLATE = app
    2. CONFIG += console
    3. CONFIG -= qt
    4.  
    5. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

    Whenever I tried to run it from within Qt Creator IDE, a Terminal jumped out and the program hangs on the screen and the program is not able to run at all. Did anybody else meet the same problem?

    cheers
    Pei
    Welcome to Vision Open
    http://www.visionopen.com

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt Creator Plain C++ Project won't run/debug...

    Which terminal program are you using. Konsole, for example, causes issue for me but the default "xterm -e" works fine.

    You will not be able to adequately debug this program unless you build it in debug mode by using "qmake CONFIG+=debug" manually or form an IDE that does the equivalent for you.

  3. #3
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator Plain C++ Project won't run/debug...

    for *&^%s sake another crossposter
    http://www.qtforum.org/article/38257...tml#post119889
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt Creator Plain C++ Project won't run/debug...

    Quote Originally Posted by amleto View Post
    Just stop posting there like we did 6 years ago and you won't be annoyed anymore
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Creator Plain C++ Project won't run/debug...

    I think you are right.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  6. #6
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt Creator Plain C++ Project won't run/debug...

    Hi, Thank you for your help Chris.

    Quote Originally Posted by ChrisW67 View Post
    Which terminal program are you using. Konsole, for example, causes issue for me but the default "xterm -e" works fine.
    When I run my application, "GNOME Terminal 3.4.1.1" jumped out automatically.

    You will not be able to adequately debug this program unless you build it in debug mode by using "qmake CONFIG+=debug" manually or form an IDE that does the equivalent for you.
    1) Yes, I'm running it, instead of debugging it.
    2) Even debugging it with CONFIG += debug, namely
    Qt Code:
    1. TEMPLATE = app
    2. CONFIG += console debug
    3. CONFIG -= qt
    4.  
    5. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 
    the terminal still hangs....


    Added after 45 minutes:


    Hi, amleto:

    Thanks for your reply. But, unfortunately, here on my computer, it doesn't work.

    Environment:
    Qt Code:
    1. $ lsb_release -a
    2. No LSB modules are available.
    3. Distributor ID: Ubuntu
    4. Description: Ubuntu 12.04 LTS
    5. Release: 12.04
    6. Codename: precise
    7.  
    8. $ uname -a
    9. Linux XXXXXXXXX 3.2.0-27-generic-pae #43-Ubuntu SMP Fri Jul 6 15:06:05 UTC 2012 i686 athlon i386 GNU/Linux
    To copy to clipboard, switch view to plain text mode 


    .pro file
    Qt Code:
    1. TARGET = noqt
    2. CONFIG += console
    3. CONFIG -= app_bundle
    4.  
    5. CONFIG -= qt
    6.  
    7. TEMPLATE = app
    8.  
    9. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

    main.cpp file
    Qt Code:
    1. #include <iostream>
    2.  
    3. using namespace std;
    4.  
    5. int main()
    6. {
    7. cout << "Hello World!" << endl;
    8. return 0;
    9. }
    To copy to clipboard, switch view to plain text mode 


    I'm guessing it might have something to do with the OS, namely, current Ubuntu.


    Thanks anyway.


    Best Regards
    Pei


    Quote Originally Posted by amleto View Post
    Last edited by jiapei100; 23rd July 2012 at 23:21.
    Welcome to Vision Open
    http://www.visionopen.com

  7. #7
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt Creator Plain C++ Project won't run/debug...

    It seems it has something to do with (QtCreator under Ubuntu 12.04) only.
    Because after the compilation and building, if I entered subfolder containing the executive, just from the bash (both Debug and Release), I'm able to have Hello World printed out. However, it seems it's just the problem from QtCreator IDE.
    And the outcome I obtained is:
    Starting ...../test_plaincpp-build-desktop-Qt_4_8_1_in_PATH__System__Debug/noqt...
    ......plaincpp-build-desktop-Qt_4_8_1_in_PATH__System__Debug/noqt exited with code 0

    Please, give me a hand....

    Best Regards
    Pei
    Welcome to Vision Open
    http://www.visionopen.com

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt Creator Plain C++ Project won't run/debug...

    Could you please check the terminal settings in Qt Creator and change it to xterm -e or just uncheck "run in terminal" in your project settings?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt Creator Plain C++ Project won't run/debug...

    Wow, Hi, Thanks wysota:

    After I uncheck "run in terminal", it seems now it's able to work !! But there is still some extra output:
    Debugging starts
    &"warning: GDB: Failed to set controlling terminal: Invalid argument\n"
    If I change Qt Creator -> Tools -> Options-> Environment -> Systems -> Terminal to "xterm -e". It's fine when running the program, but when I tried to debug it, I got an error dialog:
    Failed to start application
    ptrace: Operation not permitted.

    Anyway, uncheck "run in terminal" seems to be a better solution.

    Cheers
    Pei


    [/QUOTE]
    Quote Originally Posted by wysota View Post
    Could you please check the terminal settings in Qt Creator and change it to xterm -e or just uncheck "run in terminal" in your project settings?
    Last edited by jiapei100; 24th July 2012 at 16:22.
    Welcome to Vision Open
    http://www.visionopen.com

  10. #10
    Join Date
    Jul 2012
    Posts
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Qt Creator Plain C++ Project won't run/debug...

    Where is project options located?

Similar Threads

  1. Project file LIBS debug/release
    By bunjee in forum Qt Programming
    Replies: 5
    Last Post: 27th July 2015, 05:42
  2. Debug Qt project via Visual Studio
    By Ali Reza in forum Newbie
    Replies: 1
    Last Post: 16th June 2012, 17:11
  3. Qt Creator Can't debug the program with OpenCV in Qt Creator
    By nimingzhe2008 in forum Qt Tools
    Replies: 6
    Last Post: 15th June 2012, 15:04
  4. Replies: 8
    Last Post: 26th March 2011, 12:11
  5. Replies: 4
    Last Post: 8th August 2010, 22:00

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.