WSL中的VSCode和MPI

时间:2019-04-23 12:12:12

标签: visual-studio-code compilation mpi header-files windows-subsystem-for-linux

我在Windows上的Visual Studio Code中的C程序中使用MPI。我可以在WSL中编译并运行它,但VSCode警告我找不到mpi.h

enter image description here

我已经在WSL中安装了libopenmpi-dev,并将标头目录添加到VSCode的设置(.vscode/c_cpp_properties.json)中:

{
    "configurations": [
        {
            "name": "WSL",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/lib/gcc/x86_64-linux-gnu/7/include",
                "/usr/local/include",
                "/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed",
                "/usr/include/x86_64-linux-gnu",
                "/usr/include"
            ],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64",
            "browse": {
                "path": [
                    "${workspaceFolder}/**",
                    "/usr/lib/gcc/x86_64-linux-gnu/7/include",
                    "/usr/local/include",
                    "/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed",
                    "/usr/include/x86_64-linux-gnu",
                    "/usr/include"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 4
}

包括stdio.h之类的标准标头没有问题。如何使VSCode找到mpi.h

1 个答案:

答案 0 :(得分:0)

VS Code的remote WSL extension解决了此问题。不再需要任何配置,我安装了此扩展,并连接到WSL,一切正常。