Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26758 Discussions

Unresolved external symbol omp_get_* on VS2017.

aristotelis
Beginner
228 Views

Hello,

I am trying to build a project on VS2017 with OpenMP libraries. A minimal example of code is the following:

program checkOMP
    use omp_lib
    implicit none
    
    integer                 :: num_threads
    !integer, external  ::  omp_get_num_procs
    
    num_threads = omp_get_num_procs()
    if (num_threads > 2) then
       call omp_set_num_threads(num_threads-1)
    end if
    
    write(*,*) 'Hello World'
    
    read(*,*)
end program checkOMP

I am compiling it without issues using /Qopenmp. However, the linker throws errors about unresolved external symbols for the two omp_* procedures (LNK2019). The weird thing is that the exact same project, with the same properties, builds just fine with VS2015 on the same machine.

I tried explicitly adding the location of intel libraries to Project Properties -> Linker -> Additional Library Directories but without luck.

Do you think I am missing anything?

Thanks. 

0 Kudos
2 Replies
Steve_Lionel
Black Belt Retired Employee
228 Views

My guess is that it already had the location, but not a reference to libiomp5md.lib . Try adding that to "Additional dependencies" in Linker > General.

Why not use /Qopenmp?

aristotelis
Beginner
228 Views

Thanks Steve. It worked with your suggestion! 

Reply