I cannot make VScode find the mpi header. I just created a minimalistic example:
#include <iostream>
#include <mpi.h>
int main(){
std::cout<< "Hello World!!"<<std::endl;
return 0;
}
My tasks.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build HELLO",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
launch.json:
{
"configurations": [
{
"name": "C/C++: DEBUG HELLO",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": true,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++ build HELLO",
"miDebuggerPath": "/usr/bin/gdb"
}
],
"version": "2.0.0"
}
c_cpp_properties.json:
{
"configurations": [
{
"name": "Linux",
"includePath": ["${workspaceFolder}/**", "/usr/lib/x86_64-linux-gnu/openmpi/include"],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
Note that I added the correct include path.
Hitting the debug Play button leads to fatal error: mpi.h: No such file or directory. If I remove the header inclusion, everything works fine. VSCode re-installation does not help.
C++ extension version 1.19.9 VSCode version 1.87.2 Ubuntu 20.04.6