नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'function': local function definitions are illegal
Remarks
Code tries to define a function within a function.
Or, there may be an extra/missing brace before the location of the C2601 error.
Examples
Define function within a function
Lambda Expressions may be used to emulate the behavior of local functions:
// C2601a.cpp
int main()
{
int increment(int value) // C2601
{
return value + 1;
}
// Try the following line instead:
// auto increment = [](int value) { return value + 1; };
int two = increment(1);
}
Missing closing brace
If a preceding function is missing a closing brace, the subsequent function is taken to be a local function:
// C2601b.cpp
void func()
{
// missing '}' brace here
int main() {} // C2601