3

Being a new user of Visual Studio Community (2017), I had the bad surprise to find that my C++ console application runs in a console external to the IDE.

So I would like to know how to make my program run directly in the IDE, as it is the case for Eclipse, VSCODE, IntelliJi etc....

I have already tried the proposed solution on this subject: How do you run a console application in the Visual Studio output window, instead of opening a new command prompt? but it doesn't work for my version of VSC (2017).

I would like to know if it's possible with my version and, if yes, what changes must be done with the configuration of the IDE.

How it works now

How I would like to be

  • ***I had the bad surprise to find that my C++ console application runs in a console external to the IDE*** It's been that way in Visual Studio since at least the 1990s. – drescherjm Jan 07 '20 at 03:43
  • 1
    It isn't implemented to allow it. So you have to make change request to developer of that visual studio ... it is probably written somewhere in that program who it is. – Öö Tiib Jan 07 '20 at 03:43
  • 2
    A console application by definition runs in the system console. I'm not sure why this would be surprising. VS is an IDE designed to be for writng and debugging code. – Ken White Jan 07 '20 at 03:50

2 Answers2

2

In managed code, you could try to use System::Diagnostics::Debug::Write. In unmanaged code, You could try to use OutputDebugString. In both cases, the text will go to the Output window rather than the Immediate window. If you want it in the immediate window, inside VS you can go to Tools -> Options -> Debugging -> General and check the "Redirect all Output Window text to the Immediate Window" option.

Use the Immediate window to debug and evaluate expressions, execute statements, and print variable values. And we couldn't run the console application in the Immediate window.

As far as I'm concerned ,We couldn't equate the system console with an Immediate window. And A console application should run in the system console.

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20
0

If you run your program in the debugger of the IDE, you can use OutputDebugString instead of writing to standard output (i.e. std::cout). That way, your program's output will appear in the output window of the IDE.

However, this feature is only intended for debugging purposes and not for normal use.

Andreas Wenzel
  • 22,760
  • 4
  • 24
  • 39