[Openmp-dev] libomp.lib is not automatically added on Windows
İsmail Dönmez via Openmp-dev
openmp-dev at lists.llvm.org
Thu Aug 6 02:19:07 PDT 2015
Hi,
With http://reviews.llvm.org/D11763 I am able to compile openmp on
Windows but now another problem arises. I am building with
-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp so I expect -fopenmp to do the
right thing but:
C:\Users\ismail\Desktop>clang -O2 -fms-compatibility-version=19
-fopenmp omp_hello.c
omp_hello-78a3be.o : error LNK2019: unresolved external symbol
__kmpc_fork_call referenced in function main
omp_hello-78a3be.o : error LNK2019: unresolved external symbol
omp_get_thread_num referenced in function .omp_outlined.
omp_hello-78a3be.o : error LNK2019: unresolved external symbol
omp_get_num_threads referenced in function .omp_outlined.
omp_hello-78a3be.o : error LNK2019: unresolved external symbol
__kmpc_cancel_barrier referenced in function .omp_outlined.
a.exe : fatal error LNK1120: 4 unresolved externals
clang.exe: error: linker command failed with exit code 1120 (use -v to
see invocation)
Ok then lets try -fopenmp=libomp anyway:
C:\Users\ismail\Desktop>clang -O2 -fms-compatibility-version=19
-fopenmp=libomp omp_hello.c
omp_hello-78a3be.o : error LNK2019: unresolved external symbol
__kmpc_fork_call referenced in function main
omp_hello-78a3be.o : error LNK2019: unresolved external symbol
omp_get_thread_num referenced in function .omp_outlined.
omp_hello-78a3be.o : error LNK2019: unresolved external symbol
omp_get_num_threads referenced in function .omp_outlined.
omp_hello-78a3be.o : error LNK2019: unresolved external symbol
__kmpc_cancel_barrier referenced in function .omp_outlined.
a.exe : fatal error LNK1120: 4 unresolved externals
clang.exe: error: linker command failed with exit code 1120 (use -v to
see invocation)
Still not linking correctly, lets add libomp.lib manually:
C:\Users\ismail\Desktop>clang -O2 -fms-compatibility-version=19
-fopenmp omp_hello.c "C:\Program Files\LLVM\lib\libomp.lib"
C:\Users\ismail\Desktop>
And that works fine! Any idea why libomp.lib is not getting linked
like it does on Linux?
Thanks!
More information about the Openmp-dev
mailing list