Answered by:
mpi.h not found

Question
-
Hi,
I've installed MSMPI and am unable to get my Hello World code to compile. The compiler cannot find mpi.h
The msmpi macros are defined:
C:\Users\chris>set MSMPI
MSMPI_BENCHMARKS=C:\Program Files\Microsoft MPI\Benchmarks\
MSMPI_BIN=C:\Program Files\Microsoft MPI\Bin\
MSMPI_INC=C:\Program Files (x86)\Microsoft SDKs\MPI\Include
MSMPI_LIB32=C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x86
MSMPI_LIB64=C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64
I've added
$(MSMPI_INC);$(MSMPI_INC)\x64
to C/C++ -> General -> additional Include Directories
$(MSMPI_LIB64)
to Linker -> General -> Additional Library Directories and
msmpi.lib
to Linker -> Input -> Additional Dependencies
set the Command to
$(MSMPI_BIN)\mpiexec.exe
and the Command Line Arguments to
-n $(NUMBER_OF_PROCESSORS)
and my source code is
/ An MPI Program - Hello World
// mpi.cpp
#include <cstdio>
#include <mpi.h>
int main(int argc, char** argv) {
MPI_Init(&argc, &argv); // initializing MPI
std::printf("Hello from an MPI process\n");
MPI_Finalize(); // closing MPI
}The error is C:\Users\chris\source\repos\Project6\Project6\Source.cpp(5,10): fatal error C1083: Cannot open include file: 'mpi.h': No such file or directory
If I switch to Intel Parallel Studio XE 2020 with its respective macros this source code compiles and executes to give me
Hello from an MPI process
Hello from an MPI process
Hello from an MPI process
Hello from an MPI process
Hello from an MPI process
Hello from an MPI process
Hello from an MPI process
Hello from an MPI processAny advice appreciated
Thanks,
Chris
Friday, September 18, 2020 12:14 AM
Answers
-
Did you edit all of configurations and platforms (or the required ones), which are displayed in dropdown lists in Project Properties dialog?
- Marked as answer by Chris Szalwinski Friday, September 18, 2020 11:45 AM
Friday, September 18, 2020 7:53 AM -
For some unknown reason, closing the project and restarting it the next day appeared to have solved the compilation problem.
Notwithstanding this, setting all configurations and platforms to their respective appropriate paths did solve the compilation problem - had to add "$(TargetPath)" as last command line argument to solve the execution problem
- Edited by Chris Szalwinski Friday, September 18, 2020 1:35 PM
- Marked as answer by Chris Szalwinski Friday, September 18, 2020 1:35 PM
Friday, September 18, 2020 11:49 AM
All replies
-
Did you edit all of configurations and platforms (or the required ones), which are displayed in dropdown lists in Project Properties dialog?
- Marked as answer by Chris Szalwinski Friday, September 18, 2020 11:45 AM
Friday, September 18, 2020 7:53 AM -
For some unknown reason, closing the project and restarting it the next day appeared to have solved the compilation problem.
Notwithstanding this, setting all configurations and platforms to their respective appropriate paths did solve the compilation problem - had to add "$(TargetPath)" as last command line argument to solve the execution problem
- Edited by Chris Szalwinski Friday, September 18, 2020 1:35 PM
- Marked as answer by Chris Szalwinski Friday, September 18, 2020 1:35 PM
Friday, September 18, 2020 11:49 AM