在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/iOS  網(wǎng)絡安全/ libevent 小例子一直編譯不通過

libevent 小例子一直編譯不通過

mac 上通過brew 安裝libevent,編譯如下代碼,但就是一直不通過。

#include <stdio.h>
#include<event.h>
#include<unistd.h>
#include<event2/util.h>
int main(int argc, char const *argv[])
{
    struct event_base* base = event_base_new();
    return 0;
}

報錯信息如下:

Undefined symbols for architecture x86_64:
  "_event_base_new", referenced from:
  _main in main-d0e518.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v                                 
to see invocation)


謝謝了!

回答
編輯回答
舊城人

編譯命令中缺少 libevent 類庫,應該像這樣

clang  xx.c  -levent
2017年10月22日 21:56