#pragma omp parallel private (nt,tid) { tid = omp_get_thread_num();
printf("Ciao sono il thread %d\n",tid);
nt = omp_get_num_threads();
if (omp_get_thread_num()==1)
printf("Il numero di threads e': %d\n",nt); }
omp_set_num_threads(3);
#pragma omp parallel private (x) { x=x+1;
printf("Valore = %d\n",x);
} }
and this is the response of the compiler:
Prova.c undefined reference to 'omp_set_nested' Prova.c undefined reference to 'omp_get_nested' Prova.c undefined reference to 'omp_set_num_threads' Prova.c undefined reference to 'GOMP_parallel_start' Prova.c undefined reference to 'GOMP_parallel_end' Prova.c undefined reference to 'omp_set_num_threads' Prova.c undefined reference to 'GOMP_parallel_start' Prova.c undefined reference to 'GOMP_parallel_end'
build finished: 8 errors, 0 warnings
Title: Re: Compile OpenMp File
Post by: oBFusCATed on December 03, 2010, 02:16:51 pm
Read this please: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F Also please use code tags for such long pastes
Title: Re: Compile OpenMp File
Post by: killerbot on December 03, 2010, 02:35:56 pm
as said link with the omp library
Title: Re: Compile OpenMp File
Post by: killerbot on December 05, 2010, 09:41:37 am
Title: Re: Compile OpenMp File
Post by: Jenna on December 05, 2010, 10:25:03 am
In the Projects "Build options -> Linker settings -> Link libraries" itshould be enough to add "gomp" (the lib prefix will not be used on commandline, just "-lgomp").