I get error message frames missing and/or incorrect, no symbols loaded

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

#include<iostream>
using namespace std;

void main() {
Std::cout << "hello world";
}

How do I fix this?
How do I fix this?

The main function is required to return int.
In addition the standard namespace is called exactly std and not Std.

After making these corrections your program's source code should look like:
1
2
3
4
5
6
#include<iostream>
using namespace std;

int main() {
  std::cout << "hello world";
}
Last edited on
Why is the main function required to return int.
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.

https://eel.is/c++draft/basic.start.main

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.
Last edited on
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.
Topic archived. No new replies allowed.