Using CLion with openmp
Answered
Hi, i'm new to CLion and i have school assignment with openmp.
What should i do in order to use CLion with openmp (Mac OS).
Thank you very much!
Please sign in to leave a comment.
CLion uses CMake as a build system, so you need to configure your CMakeLists.txt to work with OpenMP. Please take a look here: http://stackoverflow.com/a/40534056.
Thank you I'll try that!
can you please explain that? does it work with mac???
@RR, yes, you can work with OpenMP in CLion on macOS. You need to configure your CMakeLists.txt in the appropriate way. Please see http://stackoverflow.com/a/40534056 as my colleague suggested in the comment above.
This doesn't work on mac. I've even downloaded gcc and switched my compiler to gcc (shown below). I've been wrestling with this for half a day and I can't get clion to recognize openmp.
@Sethd63, the compiler you installed is not gcc, it's clang. You can check it using --version in Terminal:
You need to install gcc using Homebrew, for example.
# On Mac,
I got it working along with debugger by changing the CMakeLists.txt. Make sure to change line 2 and line # 12 according to your folder name and file name. Clion is smart to detect it. But yeah, please make sure. I spent whole day to find the solution. : D.
# Also I used the gcc-13 as a compiler which is downloaded from https://formulae.brew.sh/formula/gcc instead of the default clang compiler in Mac.
Shresthapritam7, thank you for sharing!
This is not directly relevant, but still: please note that
gcc-13
is a C compiler. In the “C++ Compiler” field,g++-13
should be specified.