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
Code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
It's so strange that I'm not able to debug/run this application after building.
The .pro file is as simple as:
Code:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
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
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.
Re: Qt Creator Plain C++ Project won't run/debug...
Re: Qt Creator Plain C++ Project won't run/debug...
Quote:
Originally Posted by
amleto
Just stop posting there like we did 6 years ago and you won't be annoyed anymore :)
Re: Qt Creator Plain C++ Project won't run/debug...
Re: Qt Creator Plain C++ Project won't run/debug...
Hi, Thank you for your help Chris.
Quote:
Originally Posted by
ChrisW67
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.
Quote:
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
Code:
TEMPLATE = app
CONFIG += console debug
CONFIG -= qt
SOURCES += main.cpp
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:
Code:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise
$ uname -a
Linux XXXXXXXXX 3.2.0-27-generic-pae #43-Ubuntu SMP Fri Jul 6 15:06:05 UTC 2012 i686 athlon i386 GNU/Linux
.pro file
Code:
TARGET = noqt
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
TEMPLATE = app
SOURCES += main.cpp
main.cpp file
Code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
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
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:
Quote:
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
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?
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:
Quote:
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:
Quote:
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
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?
Re: Qt Creator Plain C++ Project won't run/debug...
Where is project options located?