【问题标题】:VSCode not compiling c++VSCode 不编译 C++
【发布时间】:2021-06-28 05:20:36
【问题描述】:

我正在运行 Ubuntu MATE 并使用 C++ 编程。我想转移到 vscode 所以我安装了它。但总的来说,我不能真正编译或调试任何东西。这适用于终端运行代码。

g++ HelloWorld.cpp -o HelloWorld.o 
./HelloWorld.o

但是如果我想通过按钮编译这个东西happens。我该怎么办?我在下面添加了 launch.json。

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "cpp - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: cpp build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

【问题讨论】:

    标签: c++ linux visual-studio-code compiler-errors compilation


    【解决方案1】:

    如果将来有人想知道解决方案是什么,请在 linux 下使用 g++ 编译 c++,然后按 ctrl+f5。那个解决了我的问题,搞了2天。

    【讨论】:

      猜你喜欢
      • 2021-06-04
      • 1970-01-01
      • 2017-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-09
      • 1970-01-01
      • 2022-01-12
      相关资源
      最近更新 更多