1

I want to use OpenMP in CodeLite, but it doesn't work.
I have already choose -fopenmp in compile setting(actually it's the default setting).
My program is as follows:

#include <stdio.h>
#include <omp.h>
int main()
{
    #pragma omp parallel
    {
        printf("Hello World!");
    }
    return 0;
}

The result of this program shows that "#include " doesn't work, and the "#pragma omp parallel" is ignored.

yazoo
  • 11
  • 3

2 Answers2

1

Make sure the openmp support library is installed, for example, on Linux with gcc, you should install the libgomp package, for example if you are on fedora, run dnf install libgomp, then try compile again.

fluter
  • 13,238
  • 8
  • 62
  • 100
1

It is necessary to pass -fopenmp to the linker to enable OpenMP features. The following steps should help you achieve that:

  1. Right click on the project in the workspace view.
  2. Select "Settings" near the bottom of this pop-up menu. Settings...->Linker->Linker Options.
  3. Click into the semicolon delimited list to reveal ellipses and click on the ellipses.
  4. Click the checkbox for "Enable OpenMP (linkage) [-fopenmp]"
  5. Re-compile the code - It should work!