windows,用vc编译器cl.exe,编译nginx的第三方模块,有类似这样的代码报错:
static ngx_int_t
ngx_http_zip_main_request_header_filter(ngx_http_request_t *r)
{
ngx_http_variable_value_t *vv;
ngx_http_zip_ctx_t *ctx;
if ((ctx = ngx_http_get_module_ctx(r, ngx_http_zip_module)) != NULL)
return ngx_http_next_header_filter(r);
if ((vv = ngx_palloc(r->pool, sizeof(ngx_http_variable_value_t))) == NULL)
return NGX_ERROR;
/* Look for X-Archive-Files */
ngx_int_t variable_header_status = NGX_OK;
错误出在ngx_int_t variable_header_status = NGX_OK;:
mod_zip/ngx_http_zip_module.c(195) : error C2275: 'ngx_int_t' : illegal use of t
his type as an expression
查了一下,原因:由于c的编译器要求将变量的声名放在一个函数块的头部,而c++没有这样的要求造成的。把声名的三个变量放到函数的开头就可以了。
同样的代码在gcc下是可以编译通过的。
请问vc有没有什么编译选项可以支持高级一点的C。我用的vc编译器已经是vs2012自带的那个了