I have code that loads library dynamically. I got errors like below after run make.
aaa.cpp:(.text+0x4ea): undefined reference to `dlopen'
aaa.cpp:(.text+0x50b): undefined reference to `dlerror'
aaa.cpp:(.text+0x54e): undefined reference to `dlsym'
aaa.cpp:(.text+0x560): undefined reference to `dlerror'
aaa.cpp:(.text+0x56f): undefined reference to `dlerror'
aaa.cpp:(.text+0x595): undefined reference to `dlclose'
aaa.cpp:(.text+0x5b8): undefined reference to `dlsym'
aaa.cpp:(.text+0x5ca): undefined reference to `dlerror'
aaa.cpp:(.text+0x5d9): undefined reference to `dlerror'
...
That makes me think dl is missing. What is the best way to install dl in Ubuntu?
UPD
libc6-dev is already installed on my system
$ sudo aptitude install libc6-dev
libc6-dev is already installed at the requested version (2.23-0ubuntu9)
libc6-dev is already installed at the requested version (2.23-0ubuntu9)
No packages will be installed, upgraded, or removed.
makefile:
# Options for development
COMPILER = g++
#CFLAGS = -c -Wall -ansi
CFLAGS = -fPIC -c
# Options for release
#CFLAGS = -c -Wall -O
client:
$(COMPILER) $(CFLAGS) c1.cpp -o c1.o
$(COMPILER) -ldl c1.o -o aa
clean:
rm *.o
rm aa
libdlis missing from your system (it's part of thelibc6-devpackage). More likely,-ldlis missing from (or in the wrong place on) your linker command line. – steeldriver Dec 19 '17 at 13:38$(COMPILER) -o aa c1.o -ldl- for reference, see (for example) Why does the order in which libraries are linked sometimes cause errors in GCC? – steeldriver Dec 19 '17 at 14:19