Linker cannot find dlsym

I am trying to compile a C ++ program on Linux Mint 17 using Qt 5.3.0. I added the following line to the .pro file:

QMAKE_LFLAGS += -ldl -fPIC

My program uses dlsym, but the linker cannot find it. Here is the error message:

undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line

How can I link my program?

+4
source share
1 answer

I suggest using a variable LIBSfor this, and not QMAKE_LFLAGSas follows:

LIBS += -ldl -fPIC
+4
source

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


All Articles