Undefined reference to `omp_get_max_threads_'

93,190

Solution 1

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.

Solution 2

The code needs to be compiled with -fopenmp.

Solution 3

gcc -program.c -o obj -fopenmp

Share:
93,190
GennSev
Author by

GennSev

Data Scientist 📊, Computer Engineer 💻, and holder of a Ph.D. 🎓 in Approximate Computing and Software Fault Tolerance.

Updated on July 09, 2022

Comments

  • GennSev
    GennSev almost 2 years

    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.