Undefined reference to `omp_get_max_threads_'

GccOpenmpGfortran

Gcc Problem Overview


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.

Gcc Solutions


Solution 1 - Gcc

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 - Gcc

The code needs to be compiled with -fopenmp.

Solution 3 - Gcc

gcc -program.c -o obj -fopenmp

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGennSevView Question on Stackoverflow
Solution 1 - GccJonathan DursiView Answer on Stackoverflow
Solution 2 - GccyyfnView Answer on Stackoverflow
Solution 3 - Gccorientchen1978View Answer on Stackoverflow