g++无法编译带有libevent和libcurl的cpp


运行 g++ -L/usr/include -levent -lcurl proxyevent.cpp 提示:


 proxyevent.cpp: 在函数‘size_t write_data(void*, size_t, size_t, void*)’中:
proxyevent.cpp:25:47: 错误:‘evbuffer_add’在此作用域中尚未声明
proxyevent.cpp: 在函数‘void cb_handler(evhttp_request*, void*)’中:
proxyevent.cpp:31:37: 错误:‘evbuffer_new’在此作用域中尚未声明
proxyevent.cpp:32:38: 错误:‘evhttp_request_uri’在此作用域中尚未声明
proxyevent.cpp:35:16: 错误:对不完全的类型‘struct evhttp_request’的非法使用
In file included from proxyevent.cpp:2:0:
/usr/local/include/event2/http.h:68:8: 错误:‘struct evhttp_request’的前向声明
proxyevent.cpp:46:41: 错误:对不完全的类型‘struct evhttp_request’的非法使用
In file included from proxyevent.cpp:2:0:
/usr/local/include/event2/http.h:68:8: 错误:‘struct evhttp_request’的前向声明
proxyevent.cpp:46:55: 错误:‘EVBUFFER_LENGTH’在此作用域中尚未声明
proxyevent.cpp:49:44: 错误:对不完全的类型‘struct evhttp_request’的非法使用
In file included from proxyevent.cpp:2:0:
/usr/local/include/event2/http.h:68:8: 错误:‘struct evhttp_request’的前向声明
proxyevent.cpp:49:58: 错误:‘EVBUFFER_DATA’在此作用域中尚未声明
proxyevent.cpp:64:30: 错误:对不完全的类型‘struct evhttp_request’的非法使用
In file included from proxyevent.cpp:2:0:
/usr/local/include/event2/http.h:68:8: 错误:‘struct evhttp_request’的前向声明
proxyevent.cpp:66:26: 错误:对不完全的类型‘struct evhttp_request’的非法使用
In file included from proxyevent.cpp:2:0:
/usr/local/include/event2/http.h:68:8: 错误:‘struct evhttp_request’的前向声明
proxyevent.cpp:69:25: 错误:‘evbuffer_free’在此作用域中尚未声明
proxyevent.cpp: 在函数‘int main(int, char**)’中:
proxyevent.cpp:80:16: 错误:‘event_init’在此作用域中尚未声明
proxyevent.cpp:81:49: 错误:‘evhttp_start’在此作用域中尚未声明
proxyevent.cpp:90:20: 错误:‘event_dispatch’在此作用域中尚未声明

求解,libcurl,libcurl-devel,libevent,libevent-devel都已经安装了.

gcc C++ bash

班普雷奥斯 10 years, 12 months ago

 g++ proxyevent.cpp -levent -lcurl

家养玉藻D前 answered 10 years, 12 months ago

Your Answer