OpenMP Library Specification

I am new to mp opening and I tried a sample program from the official site

#include <omp.h>
#include <stdio.h>
int main() {
#pragma omp parallel
printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads());
}

and I installed the library in eclipse as libgomp in the project Properties-> GCC C ++ linker -

but the program says /usr/bin/ld: cannot find -llibgompmaybe I know where I'm wrong

+3
source share
2 answers

Try linking to gompinstead libgomp: library names should be passed to the linker without a prefix lib, which it adds automatically. Hence the mistake she is trying to find liblibgomp. Don't forget the compiler flag -fopenmp, otherwise OpenMP pragmas will simply be ignored.

+5
source

gomp GCC ++ Linker- > . −fopenmp GCC ++, GCC C CCC ++

+2

Source: https://habr.com/ru/post/1768951/


All Articles