小编qwe*_*805的帖子

如何在安装了 WSL 的 Visual Studio Code 中修复“g++: error: helloworld.cpp: No such file or directory”?

我在 W10 上安装了 Visual Studio Code 来运行一些安装了 WSL 的代码(Ubuntu)。

我按照以下文章中的步骤操作:

https://code.visualstudio.com/docs/cpp/config-wsl

但是在尝试在 Visual Studio Code 中编译代码时,我不断收到以下错误消息:

"g++: error: helloworld.cpp: No such file or directory"
Run Code Online (Sandbox Code Playgroud)

3 .json 文件的配置如下:

c_cpp_properties.json

{
"configurations": [
    {
        "name": "Win32",
        "defines": [
            "_DEBUG",
            "UNICODE",
            "_UNICODE"
        ],
        "compilerPath": "/usr/bin/g++",
        "cStandard": "c11",
        "cppStandard": "c++17",
        "intelliSenseMode": "gcc-x64",
        "browse": {
            "path": [
                "${workspaceFolder}"
            ],
            "limitSymbolsToIncludedHeaders": true,
            "databaseFilename": ""
        }
    }
],
"version": 4
}
Run Code Online (Sandbox Code Playgroud)

启动文件

{
"version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/marc/projects/helloworld/helloworld.out", …
Run Code Online (Sandbox Code Playgroud)

c++ json visual-studio-code

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

c++ ×1

json ×1

visual-studio-code ×1