0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.