Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C2381

Error Message

'function' : redefinition; __declspec(noreturn) differs

A function was declared and then defined but the definition used the noreturn __declspec modifier. The use of noreturn constitutes a redefinition of the function; the declaration and definition need to agree on the use of noreturn.

The following sample generates C2381:

// C2381.cpp
// compile with: /c
void f1();
void __declspec(noreturn) f1() {}   // C2381
void __declspec(noreturn) f2() {}   // OK

Community Additions

© 2015 Microsoft