1

As in the title, I get this error, when I try to compile my program using makefile. When I run it in clion environment, everything is fine. I installed homebrew llvm library. Also I have Xcode. Here is my makefile:

output: main.o
    g++ main.o -o output

main.o: main.cpp
    g++ -fopenmp -std=c++17 -c -g -Wall -pedantic -Werror -o main.o main.cpp

I understand, there are similar questions related to this topic, however I was unable to solve this issue.

Cthuwu
  • 11
  • 2
  • try passing -Xclang -fopenmp, if it doesn't work try using clang++ – Gerardo Zinno Dec 14 '21 at 17:47
  • fatal error: 'omp.h' file not found. When using -Xclang++ I have 'unsupported -fopenmp' again. – Cthuwu Dec 14 '21 at 18:03
  • No, try compiling with `clang++ -Xclang -fopenmp -std=c++17 -c -g -Wall -pedantic -Werror -o main.o main.cpp` I also always had problems with openmp on mac, if this doesn't work consider using CMake – Gerardo Zinno Dec 14 '21 at 18:08
  • Still got fatal error: 'omp.h' file not found. Unfortunately, I have to use makefile for this assignment. – Cthuwu Dec 14 '21 at 18:29
  • @Cthuwu interesting that you got a omp.h not found when using the other setup. perhaps you need to explicitly tell it where the header file is with a -I/location/of/header. ?? – bolnad Dec 14 '21 at 18:53
  • See https://stackoverflow.com/questions/66663120/fatal-error-omp-h-file-not-found-using-clang-on-apple-m1/66688630#66688630 – Jim Cownie Dec 15 '21 at 10:17

0 Answers0