As a beginner to MPI, I have a problem to compile a simple program using MinGW on Windows 7. My editor is NetBeans.
Here's the program.
#include <iostream>
#include <mpi.h>
using namespace std;
int main(int argc, char** argv) {
MPI_Init(&argc,&argv);
cout << "Hello World " << endl;
MPI_Finalize();
return 0;
}
When I try to compile this program, the following error message appeared. The relevant part is highlighted in red. As you can see there are some funny symbol that I cannot understand. This error only happens when I put in the MPI funcitions MPI_Init and MPI_Finalize. If they are commented out then the file will compile and run (though useless). I would greatly appreciate any idea on this problem. Thank you.
g++.exe -DMPICH_IGNORE_CXX_SEEK -c -g -I/C/Program\ Files/DeinoMPI/include -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
mkdir -p dist/Debug/MinGW-Windows
g++.exe -DMPICH_IGNORE_CXX_SEEK -o dist/Debug/MinGW-Windows/cppapplication_1 build/Debug/MinGW-Windows/main.o -L/C/Program\ Files/DeinoMPI/lib -lcxx -lmpi
build/Debug/MinGW-Windows/main.o:在函数‘main’ä¸ï¼š
H:/Programmming/C++/MPI/CppApplication_1/main.cpp:11:对‘_imp__MPI_Finalize’未定义的引用
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW-Windows/cppapplication_1.exe] Error 1
make[2]: Leaving directory `/h/Programmming/C++/MPI/CppApplication_1'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/h/Programmming/C++/MPI/CppApplication_1'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)