Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Linker error when using OpenMP

jlinx77
Beginner
829 Views
Hi!
I use Visual Fortran 11.1 Windows 7 64bit to build a 32bit Library that is used from C++. Everything works as expected as far as I don't activate OpenMP in the Fortran lib. Although the C++ code links against libiomp5 as suggested by the docu, I get linker error LNK2019: unresolved external symbol _omp_get_num_procs_ .
I would appreciate any advice.
Thx,
Jan
0 Kudos
2 Replies
TimP
Honored Contributor III
829 Views
If you have the function call omp_num_procs() in your source code, the standard way to make it go away when you compile without /Qopenmp is to make it conditional compilation:

#ifdef _OPENMP
USE omp_lib
#endif
......
#ifdef _OPENMP
np=omp_get_num_procs()
#endif

This would require the /fpp compile option be set.
0 Kudos
jlinx77
Beginner
829 Views
Hi TimP,
that's what I did and as I said everything works fine without/Qopenmp. With OpenMP enabled I can compile the Fortran lib with no error. The error occurs when I link my C++ code against the Fortran lib because it can't find the OpenMP symbols although I also link against libiomp5. To make it clear: I'd like OpenMP to be enabled.
--
Jan
0 Kudos
Reply