Windows, use the vc compiler cl.exe to compile the third-party module of nginx, and an error code similar to this is reported:
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;
The error is inngx_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
After checking, the reason is: the compiler of c requires the declaration of the variable to be placed at the head of a function block, but c does not have such a requirement. Just put the three declared variables at the beginning of the function.
The same code can be compiled and passed under gcc.
I would like to ask if there are any compilation options for vc that can support more advanced C. The vc compiler I use is already the one that comes with vs2012
No way.
Because VC supports the C89 standard even in the latest 2013, because it is essentially a C++ compiler, and the syntax you need is only supported after the C99 standard, so GCC can compile and pass.
There are two solutions:
One is to change the code to comply with the C89 standard.
2. Compile using mingw
Add in the compilation command
-c99
Visual Studio 2012 does not support C99, but Visual Studio 2013 does.
Reference: C99 Wikipedia