Click here to Skip to main content
15,850,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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,
Fredrik Bornander 13-Dec-12 12:25pm    
Are you referencing VCOMPD.LIB or VCOMP.LIB?
pablo ramos1 14-Dec-12 16:37pm    
no ?!
what i would do?
Krunal Rohit 17-Mar-14 8:52am    
Using GCC compiler ??


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

Hope this will help!
Share this answer
Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900