syntax error : 'token'
The token caused a syntax error.
To determine the cause, examine not only the line listed in the error message, but also the lines above it. The following example generates an error message for the line containing the open curly brace, but the true source of the error appears on the line just above it.
void main ) // No opening parenthesis. { }
If examining the lines yields no clue to what the problem might be, try commenting out the line listed in the error message and possibly several lines above it.
If the error message occurs on a symbol immediately following a typedef variable, check that the variable is defined in the source code.
One specific reason you can get C2059 is when you compile an application that specifies a structure in the default arguments for a function. The default value for an argument must be an expression. An initializer list, such as that used to initialize a structure, is not an expression. The following example generates C2059:
// compile with /c struct ag_type { int a; float b; }; void func(ag_type arg = {5, 7.0});
The resolution is to define a constructor to perform the required initialization.
// compile with /c struct ag_type { int a; float b; ag_type(int aa, float bb) : a(aa), b(bb) {} }; void func(ag_type arg = ag_type(5, 7.0));
You can also get C2059 if you define a member template class or
function outside the class. See Knowledge Base article Q241949 for more information.