-
Notifications
You must be signed in to change notification settings - Fork 958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation error in VS2010 #510
Comments
Never mind, I changed the extension name from .c to .cpp then all errors were gone. |
Could you tell me what version you are using precisely (git commit number). I think it's because the test environment switched from Visual Studio 2010 to 2013 when changing from 1.9 to 1.10, and Visual Studio 2010 uses C90 standard while the later uses C99 |
:), I mentioned in the initial post
|
Most likely the errors are some variables that are not declared on top of the function but somewhere in between. That's forbidden in C90 but allowed in C99 and in C++ as well. |
I meant, Visual Studio 2010 is no longer in the continuous integration test any more. |
Sorry I overlooked your question, I downloaded the latest version from Github yesterday.
the source code at line 14682 is:
I downloaded the whole project as a zip file, I don't know the exact Git commit number. |
As expected, it's a declaration of a variable static struct mg_connection *
mg_connect_client_impl(const struct mg_client_options *client_options,
int use_ssl,
char *ebuf,
size_t ebuf_len)
{
struct mg_connection *conn = NULL;
SOCKET sock;
union usa sa;
struct sockaddr *psa;
socklen_t len;
...
#ifdef USE_IPV6
len = (sa.sa.sa_family == AF_INET) ? sizeof(conn->client.rsa.sin)
: sizeof(conn->client.rsa.sin6);
psa = (sa.sa.sa_family == AF_INET)
? (struct sockaddr *)&(conn->client.rsa.sin)
: (struct sockaddr *)&(conn->client.rsa.sin6);
#else
len = sizeof(conn->client.rsa.sin);
psa = (struct sockaddr *)&(conn->client.rsa.sin);
#endif
... Later I can check it manually with Visual Studio 2010 on a different PC. |
I added a Visual Studio 2010 build to AppVeyor, but the current version of the I think it's not a big problem to re-enable the Visual Studio 2010 C mode build. |
I am using VS2010 and tried to upgrade the code from 1.8 to 1.10, but lots of errors:
1> civetweb.c
1>d:\ xxx\civetweb.c(14682): error C2275: 'socklen_t' : illegal use of this type as an expression
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2tcpip.h(418) : see declaration of 'socklen_t'
1>d:\ xxx\civetweb.c(14682): error C2146: syntax error : missing ';' before identifier 'len'
1>d:\ xxx\civetweb.c(14682): error C2065: 'len' : undeclared identifier
1>d:\ xxx\civetweb.c(14683): error C2143: syntax error : missing ';' before 'type'
1>d:\ xxx\civetweb.c(14692): error C2065: 'psa' : undeclared identifier
1>d:\ xxx\civetweb.c(14692): warning C4047: 'function' : 'sockaddr *' differs in levels of indirection from 'int'
1>d:\ xxx\civetweb.c(14692): warning C4024: 'getsockname' : different types for formal and actual parameter 2
1>d:\ xxx\civetweb.c(14692): error C2065: 'len' : undeclared identifier
1>d:\ xxx\civetweb.c(15233): error C2143: syntax error : missing ';' before 'type'
1>d:\ xxx\civetweb.c(15234): error C2143: syntax error : missing ';' before 'type'
1>d:\ xxx\civetweb.c(15235): error C2143: syntax error : missing ';' before 'type'
1>d:\ xxx\civetweb.c(15236): error C2143: syntax error : missing ';' before 'type'
1>d:\ xxx\civetweb.c(15239): error C2065: 'txt' : undeclared identifier
1>d:\ xxx\civetweb.c(15239): warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
1>d:\ xxx\civetweb.c(15239): warning C4024: 'mg_snprintf' : different types for formal and actual parameter 3
1>d:\ xxx\civetweb.c(15239): error C2065: 'txt' : undeclared identifier
1>d:\ xxx\civetweb.c(15240): error C2065: 'rctx' : undeclared identifier
1>d:\ xxx\civetweb.c(15240): error C2224: left of '.config' must have struct/union type
1>d:\ xxx\civetweb.c(15240): error C2065: 'txt' : undeclared identifier
1>d:\ xxx\civetweb.c(15245): error C2065: 'rctx' : undeclared identifier
1>d:\ xxx\civetweb.c(15245): error C2224: left of '.config' must have struct/union type
1>d:\ xxx\civetweb.c(15248): error C2065: 'rctx' : undeclared identifier
1>d:\ xxx\civetweb.c(15248): warning C4133: '=' : incompatible types - from 'int *' to 'mg_context *'
1>d:\ xxx\civetweb.c(15249): error C2065: 'ret' : undeclared identifier
1>d:\ xxx\civetweb.c(15249): error C2065: 'err' : undeclared identifier
1>d:\ xxx\civetweb.c(15250): error C2065: 'octx' : undeclared identifier
1>d:\ xxx\civetweb.c(15250): warning C4047: '=' : 'mg_context *' differs in levels of indirection from 'int'
1>d:\ xxx\civetweb.c(15261): error C2065: 'ret' : undeclared identifier
The text was updated successfully, but these errors were encountered: