Windows, with the VC compiler cl.exe, compiled nginx third-party module, there is a similar code error:
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;
Error out in 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
Check it out, because C's compiler requires that the variable's reputation be placed on the head of a function block, and C + + has no such requirement. Put three of the famous variables at the beginning of a function.
The same code can be compiled and passed under GCC.
VC has no what compile option can support advanced point of C. The VC compiler I'm using is already the one that vs2012 comes with.
There is no way.
Because VC even to the latest 2013 also support the C89 standard, because it is essentially a C + + compiler, and you need the syntax is C99 standard after the support, so GCC can be compiled through.
There are two ways to solve this problem:
One is to change the code to conform to the C89 standard.
Second, compile with MinGW
Add in the Compile command
-c99
Visual Studio 2012 does not support C99, but Visual Studio 2013 supports it.
C language, VC compiler cl, how to support variables do not have to declare at function start