Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
992 views
in Technique[技术] by (71.8m points)

compiler errors - Updating includePath: Header file mpi.h cannot be found in Visual Studio Code under Windows 10

This question has been asked multiple times, that's why I apologize for asking this question again. After wasting my time for googling for hours, I have finally given up.

Like already said in the title, I am struggling to setup the MPI Framework using Visual Studio Code under Windows 10. I have downloaded MPICH for Windows from here and installed them following the instructions. I have just changed the standard installation path from C to D which shouldn't be a big deal.

Visual Studio Code and the MinGW compiler for C/C++ are already installed and up-to-date.

When I start MPI program in Visual Studio Code, the headerfile mpi.h is not found correctly. I get following error message:

#include errors detected. Please update your includePath. 
Squiggles are disabled for this translation unit (C:xxxcode.cc) C/C++(1696)
cannot open source file "sal.h" (dependency of "mpi.h")C/C++(1696)

To update my includePath as described in the error message, I clicked on the light bulb:

Include error

I opened the c_cpp_properties.json file to modify the includePath section:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "D:/Program Files (x86)/Microsoft SDKs/MPI/Include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:/MinGW/bin/gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

I added a new line D:/Program Files (x86)/Microsoft SDKs/MPI/Include in the includePath section. This is exactly the path where the header files are included. But for some reason, Visual Studio Code still shows me the include error from above. Why is that so? There is no "general" solution for this issue.

System environment variables should be fine. I was able to compile/run OpenMP programms as well.

I really need your help.

Thanks in advance!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...