我正在開發HPC。在那個HPC上安裝了舊版本的Boost,並且該增強庫沒有Boost.MPI。我請求管理員將其安裝在HPC上。但他們要求我將它安裝在我的主目錄中。所以我在主目錄上安裝了boost和boost.mpi。 Boost庫似乎工作正常。但是當我嘗試用下面的命令運行下面的代碼時,我得到了錯誤。Boost.MPI問題
測試代碼:
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <iostream>
namespace mpi = boost::mpi;
int main(int argc, char* argv[])
{
mpi::environment env(argc, argv);
mpi::communicator world;
std::cout << "I am process " << world.rank() << " of " << world.size()
<< "." << std::endl;
return 0;
}
生成命令:
mpiCC -I/home1/username/boost/include
-I/usr/mpi/gcc/openmpi-1.2.8/include/
-L/home1/username/boost/lib
-L/usr/mpi/gcc/openmpi-1.2.8/lib64/openmpi
-lboost_mpi-gcc-mt-1_35 testboostmpi2.cpp
我得到了以下錯誤尖叫:
testboostmpi2.o: In function `main':
testboostmpi2.cpp:(.text+0x59): undefined reference to
`boost::mpi::environment::environment(int&, char**&, bool)'
testboostmpi2.cpp:(.text+0x63): undefined reference to
`boost::mpi::communicator::communicator()'
testboostmpi2.cpp:(.text+0x86): undefined reference to
`boost::mpi::environment::~environment()'
testboostmpi2.cpp:(.text+0xb9): undefined reference to
`boost::mpi::environment::~environment()'
我會很感激,如果有的話,你可以幫幫我。
**「正確的順序,你需要把源文件作爲第一個參數,而不是最後一個。」** +1,因爲這個細節只花了很多小時來安裝和重新安裝boost –