简体   繁体   English

如何让 VS Code 在调试时不打开终端?

[英]How to make VS Code not open a terminal when debugging?

I've installed VS Code on Ubuntu 17.04.我已经在 Ubuntu 17.04 上安装了 VS Code。

When I debug my C++ application, the output is displayed in a dedicated terminal and not within VS Code itself (like Eclipse does).当我调试我的 C++ 应用程序时,输出显示在专用终端中,而不是在 VS Code 本身中(就像 Eclipse 那样)。

How do I make VS Code display output within the editor itself, ie, not open another terminal?如何让 VS Code 在编辑器中显示输出,即不打开另一个终端?

My launch configuration is as follows:我的启动配置如下:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "gdb",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/a.out",
            "args": ["foo", "bar", "baz"],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++"
        }
    ]
}

I'd hoped that setting externalConsole to false would solve the problem.我希望将externalConsole设置为 false 可以解决问题。 However, it didn't change anything.然而,它并没有改变任何东西。

For a C++ project, use "externalConsole": false, as follows:对于 C++ 项目,使用"externalConsole": false,如下所示:

在此处输入图像描述

This will open integrated terminal instead of external terminal.这将打开集成终端而不是外部终端。 You can use "internalConsoleOptions": "openOnSessionStart" if you want to open the debug console instead of the integrated/external console:如果要打开调试控制台而不是集成/外部控制台,则可以使用"internalConsoleOptions": "openOnSessionStart"

在此处输入图像描述

For a Java project, use, "console": "integratedTerminal" in the configurations file:对于 Java 项目,在配置文件中使用"console": "integratedTerminal"

在此处输入图像描述

Use "console": "internalConsole" if you do not want to see any debug console.如果您不想看到任何调试控制台,请使用"console": "internalConsole"

Set "console":"none" like such:像这样设置"console":"none"

"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}"
"cwd": "${workspaceFolder}"
"console": "none"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 调试时如何在VS Code的集成终端中查看C程序的output - How to view output of C program in VS Code's integrated terminal while debugging 在 Ubuntu 中使用 VS Code 进行调试 - Debugging in VS Code in Ubuntu 在 VS 代码中调试 NASM - Debugging NASM in VS code VS,C++。 代码编辑器中没有错误但是在调试时,Output Window 有很多没有意义的错误 - VS,C++. No errors in the Code Editor however when debugging, the Output Window has lots of errors that don't make sense 如何解决:使用gdb调试时VS Code中的“启动:程序“executable.out”不存在” - How to solve : "launch : program "executable.out" does not exist" in VS Code when debugging with gdb 使用vs代码调试文件时,如何将文件传递到我的程序中 - How can I pass a file into my program, when debugging it with vs code 使用GDB进行调试时,如何将std :: cin重定向到Linux终端? - How to redirect std::cin to a Linux terminal when debugging with GDB? 在Qt Creator中调试应用程序时,如何使Qt源代码可用? - How do you make the Qt source code available when debugging an application in Qt Creator? 按下按钮时如何使我的应用运行终端代码? - How can I make my app run a terminal code when pushing button? 调试时如何跳过汇编代码? - How to skip assembly code when debugging?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM