我有一个程序不能与现代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
Run Code Online (Sandbox Code Playgroud)
我在互联网上搜索了建议,但只找到了将-ldl添加到链接器的建议.但这在这里没有用.我该怎么办?
小智 12
移动autocheck.cpp,使其位于命令库中.只搜索需要在其前面出现的文件中解析的内容的库.所以你的命令应该是这样的:
gcc autocheck.cpp -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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16356 次 |
| 最近记录: |