Compiler Error C2084
function 'function' already has a body
The function has already been defined.
Before Visual Studio 2002,
The compiler would accept multiple template specializations that resolved to the same actual type, although the additional definitions would never be available. The compiler now detects these multiple definitions.
__int32
andint
were treated as separate types. The compiler now treats__int32
as a synonym forint
. This means that the compiler detects multiple definitions if a function is overloaded on both__int32
andint
and gives an error.
Example
The following sample generates C2084:
// C2084.cpp
void Func(int);
void Func(int) {} // define function
void Func(int) {} // C2084 second definition
To correct this error, remove the duplicate definition:
// C2084b.cpp
// compile with: /c
void Func(int);
void Func(int) {}