Philosobot
Philosobot

Reputation: 35

Xcode and C++ [Beginner] - Why is the Hello World program printing all this extra stuff?

Whenever I build+run my program, it displays all this extra stuff:

GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000 [Switching to process 3022 thread 0x0]

Hello, World!

Program endedwith exit code: 0

Here is the Hello World, default code:

#include <iostream>

int main (int argc, const char * argv[])
{

    // insert code here...
    std::cout << "Hello, World!\n";
    return 0;
}

Why is it printing all the extra stuff, and how can I stop it? I'm using Xcode and C++. Thanks.

Upvotes: 2

Views: 3004

Answers (3)

NSGod
NSGod

Reputation: 22948

It's printing all of that extra stuff because it's running your executable in the debugger. You can change the popup from All Output to just "Target Output" like shown in the images below:

enter image description here

enter image description here

Upvotes: 6

gdb is the GNU debugger. Running in the IDE that way seems to default to running under the debugger. In short it has nothing to do with your code and everything to do with the environment you are using.

Upvotes: 1

Michael Dautermann
Michael Dautermann

Reputation: 89519

Build the app and then run it from the command line (in Terminal) and you won't see any of that GDB stuff.

If you want to do debugging though, you'll see (and eventually come to ignore) those extra lines.

Checking really quickly, I see that Apple's newer debugger (LLDB) prints out significantly less "extra" stuff into XCode's debugging output/console.

Upvotes: 1

Related Questions