Windows, use the vc compiler cl.exe to compile the third-party module of nginx, and an error code similar to this is reported:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
The error is inngx_int_t variable_header_status = NGX_OK;
:
1 2 3 |
|
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
为情所困2017-05-16 17:28:29
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
曾经蜡笔没有小新2017-05-16 17:28:29
Visual Studio 2012 does not support C99, but Visual Studio 2013 does.
Reference: C99 Wikipedia