Moohasha
April 22nd, 2011, 04:30 AM
I've played around with writing simple MPI programs in C, but now I'm trying to do something a little more complex in C++. I'm using Eclipse, but I keep getting compile errors when I try to compile.
I'm using MPICH2 and I've modified my project properties to use mpicc for the compiler. My code is very simple:
#include <iostream>
#include "mpi.h"
int main(int argc, char** argv)
{
MPI::Init(&argc, &argv);
std::cout << "!!!Hello World!!!" << std::endl;
MPI::Finalize();
return 0;
}
Yet when I try to build I get the following errors:
**** Build of configuration Debug for project CppTesting ****
make all
Building file: ../src/CppTesting.cpp
Invoking: GCC C++ Compiler
mpicc -I/usr/include/mpi -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/CppTesting.d" -MT"src/CppTesting.d" -o"src/CppTesting.o" "../src/CppTesting.cpp"
../src/CppTesting.cpp: In function ‘int main(int, char**)’:
../src/CppTesting.cpp:14: error: no matching function for call to ‘Init(int*, char***)’
/usr/include/mpi/mpicxx.h:2697: note: candidates are: void MPI::Init()
/usr/include/mpi/mpicxx.h:2698: note: void MPI::Init(int&, char**&)
make: *** [src/CppTesting.o] Error 1
Does anyone have any suggestions?
I'm using MPICH2 and I've modified my project properties to use mpicc for the compiler. My code is very simple:
#include <iostream>
#include "mpi.h"
int main(int argc, char** argv)
{
MPI::Init(&argc, &argv);
std::cout << "!!!Hello World!!!" << std::endl;
MPI::Finalize();
return 0;
}
Yet when I try to build I get the following errors:
**** Build of configuration Debug for project CppTesting ****
make all
Building file: ../src/CppTesting.cpp
Invoking: GCC C++ Compiler
mpicc -I/usr/include/mpi -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/CppTesting.d" -MT"src/CppTesting.d" -o"src/CppTesting.o" "../src/CppTesting.cpp"
../src/CppTesting.cpp: In function ‘int main(int, char**)’:
../src/CppTesting.cpp:14: error: no matching function for call to ‘Init(int*, char***)’
/usr/include/mpi/mpicxx.h:2697: note: candidates are: void MPI::Init()
/usr/include/mpi/mpicxx.h:2698: note: void MPI::Init(int&, char**&)
make: *** [src/CppTesting.o] Error 1
Does anyone have any suggestions?