做并行开发时,用到了omp.h头文件,直接在Clion中编译时出现 undefined reference to `omp_get_wtime' 错误。
#include <omp.h>
这时候需要修改CMakeLists.txt 文件,如下:
set(CMAKE_C_STANDARD 99)
FIND_PACKAGE( OpenMP REQUIRED)
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()