Undefined reference to `omp_get_max_threads_'

GennSev picture GennSev · Mar 13, 2012 · Viewed 78.3k times · Source

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.

Answer

Jonathan Dursi picture Jonathan Dursi · Mar 13, 2012

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.