Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
48 Views

Unresolved external symbol omp_get_* on VS2017.

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
Highlighted
Black Belt Retired Employee
48 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?

0 Kudos
Highlighted
Beginner
48 Views

Thanks Steve. It worked with your suggestion! 

0 Kudos