I tried to write a c++ program. Got error messages that says frames maybe missing and/or incorrect, no symbols loaded. I am using visual studios community 2019.
My code is
It is required to return int by fiat:
[basic.start.main]/2
A program shall contain exactly one function called main that belongs to the global scope. [ ... ] Its type shall have C++ language linkage and it shall have a declared return type of type int, but otherwise its type is implementation-defined.
In practice the main function is not typically the first piece of code to run in a new process.
The main function is typically called by the C runtime library, which assumes that the main function places its returned int in a certain memory location, subject to its binary interface.
If this assumption is violated the C runtime library will expect to find a returned int where there is none. Violated assumptions are a recipe for disaster. A source of security issues, of crashes, and of software defects in general.
in a more practical sense, the OS uses the return value to know if the program bombed or not. Nonzero is an error, and your program is to supply a list of the error codes to the user to tell them what went wrong. Try it...return a 1, and see what your OS has to say :)
In an even more practical sense, if your program is useful enough to be used by someone else in a script, they can use the exit status from an 'int main' program to make decisions.
Don't spoil it by being a void main programmer and returning garbage to the environment.
I speak from practical experience; instead of having a nice easy to use $?, I had to grep through the stdout and stderr to figure out what the hell happened.
> Got error messages that says frames maybe missing and/or incorrect, no symbols loaded
You'd get those for all the 'system' libraries that VS links with your code.