Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
'identifier' : constructors not allowed a return type
A constructor cannot have a return type (not even a void
return type).
A common source of this error is a missing semicolon between the end of a class definition and the first constructor implementation. The compiler sees the class as a definition of the return type for the constructor function, and generates C2533.
The following sample generates C2533, and shows how to fix it:
// C2533.cpp
// compile with: /c
class X {
public:
X();
};
int X::X() {} // C2533 - constructor return type not allowed
X::X() {} // OK - fix by using no return type
Please sign in to use this experience.
Sign in