Click here to Skip to main content
11,639,554 members (63,184 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C
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] ;
}
}
 

the errors is : undefined reference to `omp_set_num_thread"

how can i fix this problem i use windows

Pablo italy

Think you,
Posted 13-Dec-12 5:54am
Comments
Fredrik Bornander at 13-Dec-12 12:25pm
   
Are you referencing VCOMPD.LIB or VCOMP.LIB?
pablo ramos1 at 14-Dec-12 16:37pm
   
no ?!
what i would do?
Krunal Rohit at 17-Mar-14 8:52am
   
Using GCC compiler ??

-KR
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

compile with "cc -fopenmp filename.c" then run the program using "./a.out" .

Hope this will help!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Suvendu Shekhar Giri 330
1 Sergey Alexandrovich Kryukov 259
2 CPallini 177
3 himanshu agarwal 167
4 F-ES Sitecore 160
0 OriginalGriff 9,081
1 Sergey Alexandrovich Kryukov 8,812
2 Mika Wendelius 7,027
3 Suvendu Shekhar Giri 2,650
4 F-ES Sitecore 2,548


Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 17 Mar 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100