It depends on how you start off learning C++. At the very least your starter sandbox code should look like this:
#include <iostream>
int main()
{
return 0;
}
and you should have no problems.
When it comes to introducing input/output operators, the use of using namespace std;
is a polarizing one.
Method 1:
#include <iostream>
using namespace std;
int main()
{
return 0;
}
Some people don't want you using it at all because ... what if you decide to create something called "namespace" yourself? In fact, this school of thought is very fearful of global things for reasons that escape me. Then you would have to take it out and rely on the traditional method ...
Method 2: eschewing namespace
and using std::
. You would have to use std::cout
for printing text output to the prompt and std::cin
for prompting input from the user.
Also, it looks like you are encountering multiple problems, so try attacking them one at a time. I haven't worked with g++ in a long time, so it sounds like you should first do some research on how to compile and run code with g++.