Search code examples
c++mpiidentifier

Setting up Visual Studio for MPI : Identifier not found error


I try to set up VS2017 to write some MPI programs, and i added all of these libraries like in this tutorial:

https://blogs.technet.microsoft.com/windowshpc/2015/02/02/how-to-compile-and-run-a-simple-ms-mpi-program/

and try to run simple MPI code:

#include <iostream>
#include <mpi.h>
#include "stdafx.h"


int main(int argc, char *argv[])
{   
    MPI_Init(&argc, &argv);


    MPI_Finalize();
    return 0;
}

And when I build it gives me error that MPI_Init and MPI_Finalize identifiers are not found. What to do?


Solution

  • #include "stdafx.h" must be the first include. All include directives before #include "stdafx.h" are ignored.