【发布时间】:2011-05-31 06:44:02
【问题描述】:
我有一个不使用现代 GCC 构建的程序,输出很愚蠢:
gcc -I/usr/lib/qt3/include -I/opt/kde3/include/ -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -lqt-mt -ldl -L/usr/lib/qt3/lib64 -o autocheck autocheck.cpp
autocheck.cpp: In function 'int main(int, char**)':
autocheck.cpp:64:62: warning: too many arguments for format
autocheck.cpp:79:79: warning: too many arguments for format
/tmp/ccOFReGf.o: In function `main':
autocheck.cpp:(.text+0x244): undefined reference to `dlopen'
autocheck.cpp:(.text+0x2e1): undefined reference to `dlerror'
collect2: ld returned 1 exit status
我在 Internet 上搜索了建议,但只找到了将 -ldl 添加到链接器的建议。但这在这里没有帮助。我该怎么办?
【问题讨论】:
-
这很奇怪。请尝试在一个最小示例上重现该问题,即一个只调用
dlopen并且不执行任何其他操作的小程序。 -
关于 -ldl 作用的任何信息?