reaches end of non-void function [-Werror=return-type]
时间: 2024-06-06 20:08:03 浏览: 117
Microstructure and Raman spectra of Ag-MgF2 cermet films
This warning message is typically encountered in C or C++ when a non-void function does not have a return statement at the end of the function.
In C and C++, non-void functions must have a return statement that returns a value of the function's return type. If a non-void function does not have a return statement, or if the return statement is missing a value, the compiler will issue a warning.
The warning message "reaches end of non-void function" specifically indicates that the function has reached the end of its code without encountering a return statement. This can occur in situations where the programmer has forgotten to include a return statement or has accidentally left it out.
To resolve this warning, the programmer should ensure that all non-void functions have a return statement that returns a value of the correct return type.
阅读全文