ignoring pragma omp C/C++ Origin: Application & API OSI layer 7 · Application Last updated 2 Dec 2026

warning: ignoring '#pragma omp parallel' [-Wunknown-pragmas]

The code uses OpenMP but the compiler was not told to enable it, so the code runs single-threaded.

Exact message you may see ignoring '#pragma omp parallel'unknown pragma ompundefined reference to `omp_get_thread_num'unsupported option -fopenmp
Seen on: C/C++ GCC Clang

Meaning

Without -fopenmp pragmas are ignored silently except for this warning. Link errors for omp_get_thread_num also appear.

Common causes

  • -fopenmp missing at compile or link
  • Apple Clang has no built-in OpenMP
  • MSVC needs /openmp
  • CMake target not linked with OpenMP::OpenMP_CXX

⚡ Quick fix

  1. Add -fopenmp to compile and link flags
  2. Use CMake find_package(OpenMP)
  3. On macOS install libomp and use -Xpreprocessor -fopenmp -lomp

Detailed fix by platform

CMake

  1. find_package(OpenMP REQUIRED) and target_link_libraries(app OpenMP::OpenMP_CXX)

macOS

  1. brew install libomp

How to diagnose

  1. Flag — -fopenmp used?
  2. Compiler — Apple Clang?
  3. Link — libomp/libgomp?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

C compiler cannot create executables — configure: error: C compiler cannot create executables / no acceptable C compiler found in $PATH (C/C++)C compiler cannot cre…clang: error: unsupported option '-fopenmp' — macOS: clang: error: unsupported option '-fopenmp' (OpenMP with Apple Clang) (macOS)clang: error: unsuppo…Could not find a package configuration file — CMake Error: Could not find a package configuration file provided by "Foo" (requested version 1.2) (C/C++)Could not find a pack…does not appear to contain CMakeLists.txt — CMake Error: The source directory does not appear to contain CMakeLists.txt (C/C++)does not appear to co…Error 1 — make: *** [Makefile:12: target] Error 1 — a recipe command failed (C/C++)Error 1Killed signal terminated program cc1plus — g++: fatal error: Killed signal terminated program cc1plus — compilation terminated (out of memory) (C/C++)Killed signal termina…no such target — Bazel: ERROR: no such target '//pkg:name': target 'name' not declared in package 'pkg' (C/C++)no such targetundefined reference to — C/C++: undefined reference to `function' — collect2: error: ld returned 1 exit status (C/C++)undefined reference toignoring …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.