【发布时间】:2013-06-14 15:26:49
【问题描述】:
我有一个使用 libevent 库的程序
编译程序时,编译命令如下:
gcc -o myprogram mysource.c mysource.h -levent
所以它是动态链接。
现在我想在没有 libevent 的计算机上运行这个程序, 我需要静态链接,以便我的程序可以在那台计算机上运行, 有什么简单的步骤吗?
我试过-static,但出现以下错误:
[root@kitty relay]# gcc -o relay -static mysource.c mysource.h -levent -lpcap
/usr/bin/ld: cannot find -lpcap
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
为什么?
【问题讨论】:
标签: c linux static-linking dynamic-linking libevent