Compiler Error C3266
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3266.
class' : a class-constructor must have a 'void' parameter list
Class-constructors in a class using /clr programming cannot take parameters.
The following sample generates C3266:
// C3266.cpp
// compile with: /clr
ref class X {
static X(int i) { // C3266
// try the following line instead
// static X() {
}
};
int main() {
}
The following sample generates C3266:
// C3266b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
__gc class X {
static X(int i) { // C3266
// try the following line instead
// static X() {
}
};
int main() {
}
Show: