如何安装 dl

如何安装 dl

我有动态加载库的代码。运行后出现如下错误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'
...

这让我觉得缺少了什么。在 Ubuntu 中dl安装的最佳方法是什么?dl

更新型多巴胺

libc6-dev 已安装在我的系统上

$ 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.

生成文件:

# 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

相关内容