Low Orbit Flux Logo 2 F

C++ control reaches end of non-void function

control reaches end of non-void function

If you have received the error message “control reaches end of non-void function” don’t worry the fix is probably going to be pretty easy. This just means that the function specifies a return type and you didn’t include a return statement at the end of your function. Unless a function is void it needs to return a value.

Here are three potential fixes:

The fix is probably going to be adding a return statement at the end of the function. This is an example of a working function with a return statement.


#include <iostream>

int main() {
    std::cout << "test";
    return 0;
}