I'm trying to build a simple Open MPI application for Windows. I've installed the binaries for OpenMPI-v1.6.2 (64-bit). I've also installed Visual Studio 2010. The machine(s) are Windows 7 x64.
When I attempt to compile a simple program that uses MPI::Send(), I get a linker error saying that it cannot resolve MPI::Datatype::Free(). Here's a minimal example: --------------------------------------------------- #include <mpi.h> #include <iostream> int main( int argc, char** argv ) { MPI::Init(argc,argv); // Meant to run with 2 processes. if (MPI::COMM_WORLD.Get_rank() == 0) { int data; MPI::COMM_WORLD.Recv(&data,1,MPI_INT,1,0); std::cout << "received " << data << std::endl; } else { int data = 0xdead; std::cout << "sending " << data << std::endl; MPI::COMM_WORLD.Send(&data,1,MPI_INT,0,0); } MPI::Finalize(); } --------------------------------------------------- When I compile it: mpic++ send_compile.cpp -o send_compile.exe -DOMPI_IMPORTS -DOPAL_IMPORTS -DORTE_IMPORTS --------------------------------------------------- Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64 Copyright (C) Microsoft Corporation. All rights reserved. cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release send_compile.cpp Microsoft (R) Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. /out:send_compile.exe /out:send_compile.exe "/LIBPATH:C:\Program Files (x86)\OpenMPI_v1.6.2-x64/lib" libmpi_cxx.lib libmpi.lib libopen-pal.lib libopen-rte.lib advapi32.lib Ws2_32.lib shlwapi.lib send_compile.obj send_compile.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl MPI::Datatype::Free(void)" (?Free@Datatype@MPI@@UEAAXXZ) send_compile.exe : fatal error LNK1120: 1 unresolved externals --------------------------------------------------- This program compiles and runs without complaint on an Ubuntu machine around here. I don't know what the problem is. Open MPI's documentation didn't say anything about adding the CPP defines (OMPI_IMPORTS, OPAL_IMPORTS, ORTE_IMPORTS) whose absence were causing other linker errors similar to this. Google found some items in the mailing list archive. I cannot find any information about this particular problem, though. I tried using dumpbin to get symbols that were in the .lib files installed by MPI, but didn't find any reference to that function name. I didn't find any answers looking in the MPI headers, either. I have a similar program in C that compiles and runs fine on this Windows machine. I don't know what I'm doing wrong with C++. Can someone point me in the right direction? Is there some documentation regarding getting things to work on Windows? The release notes don't address this problem, and I can't find any other documentation related to what might be different from *nix to Windows (WRT to Open MPI). Thanks. todd. P.S. This is copied from a StackOverflow question I posted (http://stackoverflow.com/questions/14988099/open-mpi-c-link-error-mpidatatypefree-on-windows). Forgive the cross-posting.