在MSYS2终端中使用clang编译器编译代码时,我遇到错误。
与在MSYS2环境中使用OpenMP的GCC相同。
gcc main.c -o main -fopenmp --->工作
clang main.c -o main -fopenmp --->无法正常工作,我遇到了错误
有人能让我知道这里出了什么问题吗?
$ clang main.c -o main -fopenmp
C:\ msys64 \ mingw64 \ bin \ ld:C:\ msys64 \ tmp \ main-f23226.o:main.c :(。text + 0x10):未定义对omp_get_max_threads'
C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0x28): undefined reference to
omp_set_dynamic'的引用
C:\ msys64 \ mingw64 \ bin \ ld:C:\ msys64 \ tmp \ main-f23226.o:main.c :(。text + 0x2d):对omp_get_max_threads'
C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0x34): undefined reference to
omp_set_num_threads'的未定义引用
C:\ msys64 \ mingw64 \ bin \ ld:C:\ msys64 \ tmp \ main-f23226.o:main.c :(。text + 0x49):未定义对__kmpc_fork_call'
C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0xeb): undefined reference to
__ kmpc_for_static_init_4'的引用
C:\ msys64 \ mingw64 \ bin \ ld:C:\ msys64 \ tmp \ main-f23226.o:main.c :(。text + 0x13d):未定义对omp_get_thread_num'
C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0x175): undefined reference to
__ kmpc_for_static_fini'的引用