当编译spdylay时,make报错:
shrpx_config.h:151: error: ISO C++ forbids declaration of ‘ev_token_bucket_cfg’ with no type shrpx_config.h:151: error: expected ‘;’ before ‘*’ token shrpx_config.h:153: error: ISO C++ forbids declaration of ‘ev_token_bucket_cfg’ with no type shrpx_config.h:153: error: expected ‘;’ before ‘*’ token In file included from shrpx_config.cc:42: shrpx_ssl.h:50: error: ‘bufferevent_rate_limit_group’ has not been declared
参考:http://www.cnblogs.com/wanghetao/archive/2012/02/20/2360588
出现这个错误,一般是由于两个CPP相互都相互包含了对方的头文件造成的,比如:当mainwindow.cpp、configdialog.cpp两个文件,分别包含了对方的头文件,并且分别又在自己的类中声明了对象。
解决方法是,在声明对象的类名称前追加关键字“class”。
打开 spdylay/src/shrpx_config.h :
ev_token_bucket_cfg *rate_limit_cfg; ev_token_bucket_cfg *worker_rate_limit_cfg;
修改为:
class ev_token_bucket_cfg *rate_limit_cfg; class ev_token_bucket_cfg *worker_rate_limit_cfg;
重新make,此报错消失。