anderkve / FYS3150

https://anderkve.github.io/FYS3150
26 stars 14 forks source link

Linking error OpenMP on Linux #86

Closed vebjoro closed 1 year ago

vebjoro commented 1 year ago

Hi,

I am trying to link the code for problem 8: g++ prob_8.o state.o -larmadillo -lomp -o main

but I get the following error message:

/usr/bin/ld: cannot find -lomp: No such file or directory collect2: error: ld returned 1 exit status make: *** [makefile:12: prob_8] Error 1

Does anyone have a fix for this?

anderkve commented 1 year ago

Hi @vebjoro!

First, generally the way to use openmp is not to add -lomp, but rather use the compiler flag -fopenmp, see the examples here: https://github.com/anderkve/FYS3150/tree/master/code_examples/omp_parallelization (OpenMP support is sort of a built-in feature of most compilers.)

If that doesn't work, here are some questions and things you can try: