Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 1.11 KB

compiler-error-c2561.md

File metadata and controls

39 lines (30 loc) · 1.11 KB
descriptiontitlems.datef1_keywordshelpviewer_keywordsms.assetid
Learn more about: Compiler Error C2561
Compiler Error C2561
11/04/2016
C2561
C2561
0abe955b-53a6-4a3c-8362-b1a8eb40e8d1

Compiler Error C2561

'identifier' : function must return a value

The function was declared as returning a value, but the function definition does not contain a return statement.

This error can be caused by an incorrect function prototype:

  1. If the function does not return a value, declare the function with return type void.

  2. Check that all possible branches of the function return a value of the type declared in the prototype.

  3. C++ functions containing inline assembly routines that store the return value in the AX register may need a return statement. Copy the value in AX to a temporary variable and return that variable from the function.

The following sample generates C2561:

// C2561.cppintTest(int x) { if (x) { return; // C2561// try the following line instead// return 1; } return0; } intmain() { Test(1); }
close