OpenMP库规范 [英] OpenMP library specification

查看:125
本文介绍了OpenMP库规范的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来打开mp的人,并且尝试了来自官方网站的示例程序

i am new to open mp and i tried an sample program from the official site

#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());
}

并且我在Eclipse中将库设置为项目Properties-> GCC c ++ linker-

and i have set the library in the eclipse as libgomp in project Properties->GCC c++ linker-

但是程序说/usr/bin/ld: cannot find -llibgomp我可以知道我哪里错了

but the program say /usr/bin/ld: cannot find -llibgomp can i know where i am wrong

推荐答案

尝试使用gomp而不是libgomp进行链接:库名称必须不带lib前缀而自动传递给链接器.因此,该错误正在尝试找到liblibgomp.不要忘记编译器标志-fopenmp,否则OpenMP编译指示将被忽略.

Try linking with gomp instead of libgomp: library names must be passed to the linker without the lib prefix, which it adds automatically. Hence the error, it is trying to find liblibgomp. Don't forget the compiler flag -fopenmp, otherwise the OpenMP pragmas will simply be ignored.

这篇关于OpenMP库规范的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆