c++visual-studio-2012mpilnk2019

Installed MPI but still linker error LNK2019 appears


I've installed MS-MPIv5 from Microsoft and also the debugger for msmpi. In proejct properties in VS2012, I've changed C/C++ -> Additional include libraries adding "$(MSMPI_INC); $(MSMPI_INC)\x64" and also Linker -> All options->Additional Dependencies adding "msmpi.lib;", but VS is still giving me al lot of linker errors such as

error LNK2019: unresolved external symbol _MPI_Barrier@4

unresolved external symbol _MPI_Bcast@20

and so on, with all the mpi functions or type of variables. Is there something I forgot to change or add?


Solution

  • I haven't used 2012, but if it's similar to the older versions of VS then this detailed link may help. In general make sure to do these 3 things:

    1. Add the "Additional Include Directories"
    2. Add the "Additional Library Directories"
    3. Add the "Additional Dependencies" (msimpi.lib)

    It sounds like you may be missing the 2nd step?