skip to Main Content

When I try to run a simple "Hello World" script in vs code it prints a bunch of other clutter.

Here’s my simple code:

#include <bits/stdc++.h>

using namespace std;

int main(){
    cout << "Hello World" << endl;
}

I ran this 2 times back to back and here’s the output:

PS D:programming_stuffprojects>  & 'c:UsersUser.vscodeextensionsms-vscode.cpptools-1.22.11-win32-x64debugAdaptersbinWindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-krl1yqsi.bim' '--stdout=Microsoft-MIEngine-Out-j3natwkm.1o0' '--stderr=Microsoft-MIEngine-Error-nnjiydra.g0e' '--pid=Microsoft-MIEngine-Pid-jmdqiobi.wwj' '--dbgExe=C:msys64ucrt64bingdb.exe' '--interpreter=mi'
Hello World
PS D:programming_stuffprojects> ^C
PS D:programming_stuffprojects>   
PS D:programming_stuffprojects>  & 'c:UsersUser.vscodeextensionsms-vscode.cpptools-1.22.11-win32-x64debugAdaptersbinWindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-jmlk454c.a0g' '--stdout=Microsoft-MIEngine-Out-3y4jt5yw.dtc' '--stderr=Microsoft-MIEngine-Error-4wh2m2ti.h52' '--pid=Microsoft-MIEngine-Pid-0nouoasj.5gz' '--dbgExe=C:msys64ucrt64bingdb.exe' '--interpreter=mi'
Hello World

It runs fine and prints out "Hello World" 2 times just like I expect it to but how do I make it so that it prints things without those random symbols and other clutter? I’m not getting any error messages as far as I can tell. My compiler path is "cl.exe". I’m running this on windows 10. My "c_cpp_properties.json" looks like this:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.22621.0",
            "compilerPath": "cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

I’m very much a beginner at this so any help is appreciated.

2

Answers


  1. ^C is an interrupt, namely Ctrl-C. It’s used to terminate the execution of a process from the command line.
    Your prompt invokes the WindowsDebugLauncher… It uses gdb, apparently… My guess is that when you stop the debugger in the ide, it sends the interrupt to gdb. It’s caught by powershell (not sure why. Did you press the stop button twice?)

    You could compile and run without debugger. That should fix it? 🤔

    Login or Signup to reply.
  2. This clutter is part of Visual Studio Code implementation. The idea is, if something breaks inside Visual Studio Code, you could use this "debugging info" to diagnose what exactly broke. You better learn to ignore this clutter; it’s just part of Visual Studio Code user experience.

    One way to avoid it is to run your program directly instead of using the debugger. For that, use the "Terminal" window inside Visual Studio Code, or, in fact, close Visual Studio Code and use your shell to run your program.

    If you absolutely need a cleaner user experience, use another IDE (e.g. Visual Studio).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search