Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined reference to `omp_get_max_threads_'

I'm getting the following errors trying to compile a project: (fortran, using gfortran)

undefined reference to `omp_get_max_threads_'

undefined reference to `omp_get_thread_num_'

Problem is, my GCC version is 4.4.3, which was suppose to support OpenMP.

like image 858
GennSev Avatar asked Mar 13 '12 13:03

GennSev


3 Answers

With gcc, you need to compile and link with -fopenmp to enable OpenMP. Other compilers have different options; with intel it's -openmp, with pgi it's -mp, etc.

like image 126
Jonathan Dursi Avatar answered Sep 19 '22 04:09

Jonathan Dursi


The code needs to be compiled with -fopenmp.

like image 44
yyfn Avatar answered Sep 20 '22 04:09

yyfn


gcc -program.c -o obj -fopenmp

like image 29
orientchen1978 Avatar answered Sep 22 '22 04:09

orientchen1978