mfc xutility error
as per MSDN the error refer to some details which i am giving below and lets see if it helps u...
Visual C++ Concepts: Building a C/C++ Program
Compiler Error C2059
Language Filter: All Language Filter: Multiple Language Filter: Visual Basic Language Filter: C# Language Filter: C++ Language Filter: J# Language Filter: JScript
Visual Basic (Declaration)
Visual Basic (Usage)
C#
C++
J#
JScript
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Error Message
syntax
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.
Copy Code
// C2059a.cpp
// compile with: /c
int main ) {} // C2059 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.
You may get C2059 if a symbol evaluates to nothing, as can occur when you compile with /Dsymbol=.
Copy Code
// C2059b.cpp
// compile with: /DTEST=
#include <stdio.h>
int main()
{
#ifdef TEST
printf_s("\nTEST defined %d", TEST); // C2059
#else
printf_s("\nTEST not defined");
#endif
}
Another 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 resolution is to define a constructor to perform the required initialization.
The following example generates C2059:
Copy Code
// C2059c.cpp
// compile with: /c
struct ag_type
{
int a;
float b;
// Uncomment the following line to resolve.
// ag_type(int aa, float bb) : a(aa), b(bb) {}
};
void func(ag_type arg = {5, 7.0}); // C2059
void func(ag_type arg = ag_type(5, 7.0)); // OK
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.
C2059 can occur for an ill-formed cast.
The following sample generates C2059:
Copy Code
// C2059d.cpp
// compile with: /clr
using namespace System;
ref class From {};
ref class To : public From {};
int main()
{
From^ refbase = gcnew To();
To^ refTo = safe_cast<To^>(From^); // C2059
To^ refTo2 = safe_cast<To^>(refbase); // OK
}
C2059 can also occur if you attempt to create a namespace name that contains a period.
The following sample generates C2059:
Copy Code
// C2059e.cpp
// compile with: /c
namespace A.B {} // C2059
// OK
namespace A
{
namespace B
{
}
}
C2059 can also occur if you define a member template class or function outside the class. See Knowledge Base article Q241949 for more information. You can find Knowledge Base articles on the MSDN Library CD-ROM or at
https://support.microsoft.com.
Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.