Voila
Voila

Reputation: 328

omp.h header file not found in SUSE linux

I wanted to execute a simple OPENMP Program in Suse linux and when I compile it with commmand "gcc -openmp example.c -O example" it gives an error "omp.h header not found" . How can include this header file so that i can execute this .

Upvotes: 1

Views: 4330

Answers (1)

Hristo Iliev
Hristo Iliev

Reputation: 74385

when I compile it with commmand "gcc -openmp example.c -O example"

You error is that the flag that enables OpenMP handling in GCC is -fopenmp and not -openmp. With -fopenmp the path to omp.h is added automatically to the list of include paths.

As to where the actual omp.h file is located - it is usually located together with the other support files in the library folder. On RedHat-based distros it is in /usr/lib/gcc/<arch>-redhat-linux/<version>/include/omp.h where <arch> is the architecture (e.g. x86_64) and <version> is the GCC version (e.g. 4.4.4). Other distros may choose a different place.

One more thing - the option to specify the output executable is -o (small letter O). -O (capital letter O) enables some basic optimisations on the compiled code.

Upvotes: 3

Related Questions