【发布时间】:2013-11-18 19:46:47
【问题描述】:
我有一些使用 OpenMPI 的 *.cpp 文件。我也有 *.h 文件,其中指定了我的功能(其中一些)和它们的实现:
void Show(std::string s);
void ShowLine(std::string s);
void MPI_Output();
所以我在我的 *.cpp 文件中使用了这些函数,例如:
/*...*/
MPI_Output();
包括这个标题:
#include "my_h.h"
然后我尝试用mpicc 编译我的frogram:
mpicc -w my_best_program.cpp
在编译过程中失败并显示以下消息:
/tmp/icpcBCoxCA.o: In function `main':
MPIDebug9.cpp:(.text+0xa46): undefined reference to `ShowLine(std::string)'
MPIDebug9.cpp:(.text+0xa90): undefined reference to `MPI_Output()'
MPIDebug9.cpp:(.text+0xc0f): undefined reference to `Show(std::string)'
/tmp/icpcBCoxCA.o: In function `info_main(double)':
MPIDebug9.cpp:(.text+0xe49): undefined reference to `Show(std::string)'
/tmp/icpcBCoxCA.o: In function `info(double)':
MPIDebug9.cpp:(.text+0x104e): undefined reference to `ShowLine(std::string)'
另外,一些信息:
mpicc --showme:compile
-I/usr/mpi/intel/openmpi-1.4.4/include -pthread
我的问题有什么解决办法吗?
【问题讨论】:
标签: c++ compilation compiler-errors mpi openmpi