運行的openmpi命令 「mpicxx hello_cxx.cc -o你好」,而的openmpi:錯誤:「MPI」尚未聲明
hello_cxx.cc: In function ‘int main(int, char**)’:
hello_cxx.cc:25:5: error: ‘MPI’ has not been declared
MPI::Init();
^~~ hello_cxx.cc:26:12: error: ‘MPI’ has not been declared
rank = MPI::COMM_WORLD.Get_rank();
^~~ hello_cxx.cc:27:12: error: ‘MPI’ has not been declared
size = MPI::COMM_WORLD.Get_size();
^~~ hello_cxx.cc:31:5: error: ‘MPI’ has not been declared
MPI::Finalize();
^~~
爲了幫助這將真正幫助看看,你把在這裏的代碼,而不是隻有兩行。 –
此外,它也會幫助您知道哪些操作系統,您使用的OpenMPI版本。 –
我已經嘗試了3個不同的版本,都是Ubuntu Kylin 17.04中的版本2或更高版本。 –