When I try to compile my code in Visual Studio, I am getting C2065 Errors on every for loop, like this one:
int i;
for (i = 0; i < PQntuples(res); ++i)
{
printf(STATISTICS_TABLE_LINE, PQgetvalue(res,i,0), PQgetvalue(res,i,1),
PQgetvalue(res,i,2), PQgetvalue(res,i,3), PQgetvalue(res,i,4));
}
The errors say:
error C2065: 'i': undeclared identifier
As you can see, I am declaring the identifier i, but I am still getting this error.
Does anyone know why?
Visual C does not support C99 and do not allow mix type declarations. That's the reason behind this. Now try to declare
iin the beginning of your program (just C89 style) and you will get rid off from this error.