0

您好我尝试在 Eclipse 中编译 openmpi 应用程序。但它返回错误

gcc.exe:错误:/IC:\OpenMPI/include:无效参数

据我了解 gcc 需要破折号“-”作为斜杠“/”的参数前缀插入。(我已经覆盖了从 ms-cl 到 gcc 的编译器)

你能问我必须在哪里指定“-I”作为包含前缀吗?

4

2 回答 2

1

The compiler wrappers (mpicc, mpic++, etc.) in Open MPI are C++ programs that read in text configuration files found in <install dir>/share/openmpi (on Unix system) and probably in <install dir>\share\openmpi on Windows. These files are called <wrapper name>-wrapper-data.txt where <wrapper name> is the name of the compiler wrapper. For example for mpicc the wrapper confiration file is called mpicc-wrapper-data.txt. Inside you'd find something similar to:

...
preprocessor_flags=-I/opt/MPI/openmpi-1.6.1/linux/intel/include ...
compiler_flags=-fexceptions -pthread -I${prefix}/lib/lib32 ...
linker_flags= -L/opt/lsf/8.0/linux2.6-glibc2.3-x86/lib ...
libs=-lmpi -losmcomp -lrdmacm -libverbs ...
...

Modify these to match your compiler flags.

于 2012-10-15T12:10:29.730 回答
0

在 Eclipse 中,突出显示“Project Explorer”(屏幕左侧)中的项目名称。然后右键单击它并选择“属性”(列表底部)。在弹出窗口的左侧选择“C/C++ Build”,在该组中选择“Settings”。在“GCC C Linker”中选择“Libraries”(中心部分)。在此窗口的右侧,您可以添加库名称,它们将以“lib”和“-l”为前缀,因此不要包括(ei:mpi)。如果您需要,向下滚动将显示一个区域以添加“库搜索路径(-L)”。完成后选择“应用并关闭”按钮,然后再次“构建”。

于 2018-12-16T18:37:51.230 回答