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

标签 c++ visual-studio ubuntu visual-studio-code

我已经在 Ubuntu 17.04 上安装了 VS Code。

当我调试我的 C++ 应用程序时,输出显示在专用终端中,而不是在 VS Code 本身中(就像 Eclipse 那样)。

如何让 VS Code 在编辑器中显示输出,即不打开另一个终端?

我的启动配置如下:

{
    "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++"
        }
    ]
}

我希望将 externalConsole 设置为 false 可以解决问题。然而,它并没有改变任何东西。

最佳答案

对于C++项目,使用"externalConsole": false,如下:

enter image description here

这将打开集成终端而不是外部终端。如果您想打开调试控制台而不是集成/外部控制台,您可以使用 "internalConsoleOptions": "openOnSessionStart":

enter image description here

对于 Java 项目,在配置文件中使用 , "console": "integratedTerminal":

enter image description here

如果您不想看到任何调试控制台,请使用 "console": "internalConsole"

关于c++ - 如何让 VS Code 在调试时不打开终端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45063818/

相关文章:

c++ - 四舍五入到 100 单位

c++ - ImportError :/usr/lib/libboost_python. so.1.54.0: undefined symbol: PyClass_Type

c# - 找不到错误 MSB4226 MSBuild.Community.Tasks.Targets

php - 是什么限制了我的 PHP 资源?

c# - C# 中的 C++ dll

c++ - MSVC linker error LNK2019 when reusing a base class in C++ 解决方案

c# - Visual Studio 2010 插件 - 将上下文菜单添加到解决方案资源管理器

visual-studio - 在卸载项目的情况下启动Visual Studio解决方案

mysql - '错误 1102 (42000) : Incorrect database name 'database name

java - Intellij IDEA 看不到类,但通过 Gradle 构建可以工作