[英]OpenMP library specification
i am new to open mp and i tried an sample program from the official site 我是新手打开mp,我尝试了一个来自官方网站的示例程序
#include <omp.h>
#include <stdio.h>
int main() {
#pragma omp parallel
printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads());
}
and i have set the library in the eclipse as libgomp in project Properties->GCC c++ linker- 我已经在eclipse中将库设置为项目属性 - > GCC c ++链接器中的libgomp-
but the program say /usr/bin/ld: cannot find -llibgomp
can i know where i am wrong 但程序说/usr/bin/ld: cannot find -llibgomp
我能知道我哪里错了
Try linking with gomp
instead of libgomp
: library names must be passed to the linker without the lib
prefix, which it adds automatically. 尝试使用gomp
而不是libgomp
:必须将库名称传递给链接器而不使用lib
前缀,它会自动添加。 Hence the error, it is trying to find liblibgomp
. 因此错误,它试图找到liblibgomp
。 Don't forget the compiler flag -fopenmp
, otherwise the OpenMP pragmas will simply be ignored. 不要忘记编译器标志-fopenmp
,否则将忽略OpenMP pragma。
Add gomp to GCC C++ Linker->Libraries. 将gomp添加到GCC C ++ Linker-> Libraries。 Then add −fopenmp
to the Miscellaneous flags for GCC C++ Compiler, GCC C Compiler, and GCC C++ Linker 然后将−fopenmp
添加到GCC C ++编译器,GCC C编译器和GCC C ++链接器的杂项标志
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.