Linking pthread/dl errors when building netgen program

More
3 years 8 months ago #3588 by rick42
Hi, I have tried building the minimal netgen test program below

Code:
#include <cstddef> namespace nglib { #include <nglib.h> } int main() { nglib::Ng_Init(); nglib::Ng_Exit(); }

using the command
Code:
g++ src/main.cpp -L/opt/netgen/lib -I/opt/netgen/include -lnglib -ldl -lpthread -pthread

but linking always fails finding pthread_create and dladdr as
Code:
/opt/netgen/lib/libinterface.so: undefined reference to `pthread_create' /opt/netgen/lib/libngcore.so: undefined reference to `dladdr' collect2: error: ld returned 1 exit status
so I'm assuming there is some issue linking "dl" and "pthread" but no matter how or in which position I put the flags helps. Any ideas what could be the issue here? (Working in Ubuntu Linux 18.10 and gcc 7.5)
Time to create page: 0.082 seconds