Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linker cannot find dlsym

I'm trying to compile a C++ program in Linux Mint 17 using Qt 5.3.0. I have added the following line into .pro file:

QMAKE_LFLAGS += -ldl -fPIC

My program uses dlsym, but the linker cannot find it. Here's 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?

like image 406
SurvivalMachine Avatar asked Jun 05 '14 16:06

SurvivalMachine


1 Answers

I suggest to use the LIBS variable for this rather than the QMAKE_LFLAGS as follows:

LIBS += -ldl -fPIC
like image 155
lpapp Avatar answered Sep 28 '22 05:09

lpapp