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

**Code:** `ignoring pragma omp` · **Category:** C/C++ · **Seen on:** C/C++, GCC, Clang

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cpp/openmp-fopenmp-ignored-pragma)
