Reputation: 529
I've been trying to run the code from https://github.com/dungtn/mpi-floyd/blob/master/floyd2d.c in my system. I'm using CodeBlocks IDE and MS-Mpi. When I try to compile the code, it says undefined reference to MPI_file_seek@12. Does this mean MS mpi does not support this function or why does this happen?
Upvotes: 1
Views: 1600
Reputation: 74485
This usually happens if you are trying to link 32-bit code with 64-bit libraries. The fact that the unresolved symbol has @12
in its name means that the compiler is expecting that MPI_File_seek
is an stdcall function. stdcall is mainly used for DLL functions and only on x86 (x64 uses a different calling convention similar to fastcall). If you are linking against the 64-bit import library of MS-MPI, the decorated symbol won't be found in the library and such an error will occur.
Double check what version of MS-MPI you have and also your project settings and make sure that both have the same "bitness".
Upvotes: 4
Reputation: 87391
Change the project settings in Code::Blocks to a C project (rather than C++ project, what you have currently). It may be easier to create a brand new C project and import the file there. Double check that Code::Blocks in running gcc
and not g++
to compile your code (floyd2d.c
).
If it still doesn't work, please post the full compiler and linker output of Code::Blocks, including the commands run and their output messages.
Upvotes: 1