I need to install OpenMP on my Mac and use it in CLion. I re-installed gcc, confirmed I have it, /usr/bin/local/gcc-7. Do not understand if this comes with OpenMP or if I need to install something extra.
CMakeLists.txt
cmake_minimum_required(VERSION 3.9)
project(lab_3)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
add_executable(lab_3 main.cpp)
main.cpp
#include <iostream>
#include <omp.h>
int main() {
#pragma omp parallel for
for (int i=0; i<10; i++) {
std::cout << "This is thread #" << omp_get_thread_num() << std::endl;
}
return 0;
}
Error message:
clang: error: unsupported option '-fopenmp'