未定义的对“omp_set_num_thread”的引用? [英] undefined reference to `omp_set_num_thread" ?

查看:1913
本文介绍了未定义的对“omp_set_num_thread”的引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,



i在Code :: Blocks中使用OPENMP时出现问题



hi friends,

i have a problem in using the OPENMP in Code::Blocks

#include <omp.h>
#include <stdio.h>



int main (int argc, char *argv[])
{
int i;
int A[128], B[128],C[128] ;
for( i=0;i<128;i++)
{C[i]=0;A[i]=3;B[i]=2 ;}

omp_set_num_thread (4);
#pragma omp parallel
{
int id;
id = omp_get_thread_num();
for (i =id*8 ; i<(id+1)*8 ; i++)
C[i] = A[i]+ B[i] ;
}
}





错误是:未定义引用`omp_set_num_thread'



我怎么能解决这个问题我用的是窗户



巴勃罗意大利



想你,



the errors is : undefined reference to `omp_set_num_thread"

how can i fix this problem i use windows

Pablo italy

Think you,

推荐答案

使用cc -fopenmp filename.c编译,然后使用./a.out运行程序。



希望这会有所帮助!
compile with "cc -fopenmp filename.c" then run the program using "./a.out" .

Hope this will help!


看到这个主题:如何使用C :: B启用OpenMP? [ ^ ]。
See this thread: "How to enable OpenMP with C::B?"[^].


这篇关于未定义的对“omp_set_num_thread”的引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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