【问题标题】:VSCode terminal ctrl-click in out of source build does not find fileVSCode 终端 ctrl-click in out of source build 找不到文件
【发布时间】:2021-07-15 11:04:51
【问题描述】:

所以,我的项目目录布局如下:

.vscode/
build/
src/

当我进行源外构建时,我的所有编译器警告和错误都指向具有 ../src/stuff.cpp:123:4 之类路径的文件,并以 ../ 开头,因为 GCC 是从 build 文件夹运行的。

然后当我在 VSCode 中按住 ctrl-click 时,它很困惑:

我每次都需要手动删除../,以便VSCode找到文件。

有没有我可以调整的 VSCode 设置?

【问题讨论】:

    标签: c++ gcc visual-studio-code cmake vscode-settings


    【解决方案1】:

    我在任务中使用了以下部分

          "options": {
            "cwd": "${workspaceFolder}/build"
          },
          "problemMatcher": {
            "base": "$gcc",
            "pattern": {
              "regexp": "^../(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
              "file": 1,
              "line": 2,
              "column": 3,
              "severity": 4,
              "message": 5
            }
          },
    

    现在可以在问题面板中点击错误

    【讨论】:

      猜你喜欢
      • 2012-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-17
      • 2023-04-01
      • 2020-04-09
      • 2022-10-30
      相关资源
      最近更新 更多