linking OpenMP statically with GCC
问题 Given the following file print.cpp #include <stdio.h> int main() { printf("asdf\n"); } I can link this statically like this g++ -static print.cpp or like this g++ -static-libgcc -Wl,-Bstatic -lc print.cpp -o print But now let's add a little OpenMP and call the file print_omp.cpp #include <omp.h> #include <stdio.h> int main() { printf("%d\n", omp_get_num_threads()); } I can link this statically like this (I checked it with ldd ) g++ -fopenmp -static print_omp.cpp However, this does not work g+