0

Programs compiled in "simple c++" mode in QtCreator don't work correctly when launching them from qtcreator, but work when launching out from this ide.

When launching from QtCreator, the terminal window opens, i can enter in it anything, but program instructions don't work. The behavior without QtCreator is normal. This problem is in both: Debug and Release - buildes. Moreover, when i'm trying to use debug, breakpoints don't work too (even breakpoint set to the first line of main() function in main.cpp).

What can I do to solve this problem? Is this a bug or I'm just clumsy? Thank you.

The simple code that reproduce this problem:

#include <iostream>

using namespace std;

int main()
{
    int num;
    cin >> num;
    cout << num << "\nHello world!\n";
    return 0;
}
Ivan Akulov
  • 4,323
  • 5
  • 37
  • 64

1 Answers1

1

There could be several things that are not correctly configured.. You could try:

In your .pro file check if CONFIG += console is present.

Check that Project->Run settings, check "Run in Terminal" is ticked.

Qt Creator->Preferences : Environnement : General : Terminal : Try putting the whole path to the terminal.

Depending on your operating system you sould check if the console qtcreator is using is correctly configured. If you are using linux check if your terminal is set to: /usr/bin/xterm -e

To fix the debug issues try:
- Go to Projects(left panel) -> Build -> Edit Build Configuration: select Qt X.X.X Debug
- Under General select Qt Version Qt X.X.X for Desktop (Qt SDK)
- Above your run button(left panel) you have a button to configure the current build.. select debug one
- Select Build(from menu) -> Clean All
- Press F5

  • Thank you, now it can be run, but when I try to debug it it writes error "ptrace: operation not permitted". I googled and i found http://askubuntu.com/questions/41629/after-upgrade-gdb-wont-attach-to-process but is there any normal solutions? E.g. Eclipce works great with debug... – Ivan Akulov Apr 28 '12 at 08:46
  • Are you building it in release or debug mode ?(in release mode you can't use any break points..) You also have to have the tool chain set up for debug mode.. – elephantintheroom Apr 28 '12 at 10:23