Search code examples
c++windowscodeblockslibgomp

What wrong with OMP APIs?


Sorry again for my ignorance, I want to run #include <omp.h> for the #pragma omp parallel for command.
As it didn't work for me I checked my gcc version and it is 5.1.0, I added the libgomp.a and libgomp.spec files to the mingw lib folder. From codeblocks-> settings-> compiler I added -fopenmp on other compiler options and -lgomp -pthread on other linker options as suggested by any online guide.
Result: "undefined reference to GOMP_parallel", "undefined reference to omp_get_num_threads" and "undefined reference to omp_get_thread_num". I'm on windows 10 and running codeblocks for c ++.


Solution

  • GCC 5.1.0 is extremely old!

    Use a newer GCC (current is 12.1.0) with MinGW-w64 (instead of MinGW, which is also very old).

    There is a standalone package available for both 32-bit and 64-bit Windows at https://winlibs.com/ and the site also explains how to configure Code::Blocks to use it.