You aren't "running" that code: you are compiling it. You cannot run code until it compiles without errors (and preferably without warnings either).
Start by looking at the actual error message - begin with the first:
ponggame.cpp:278:1: error: expected ‘}’ at end of input
}
^
That tells you a lot of things, if you just look:
The file the error was found in: ponggame.cpp
The line it was found on: 278
The column on which it was found: 1
The problem that was found: "expected ‘}’ at end of input"
And it also shows you the actual line and a pointer to where the problem is:
}
^
Probably, that's the last line of the file, and the error is that it expects a "}" to match up with an "{" you have inserted - if the brackets don't match up, you will always get an error.
So somewhere in your code you forgot to close a function definition, loop body, conditional block, or similar. For example:
void foo(void)
{
...
void bar(void)
{
...
}
Because you forgot to end the
foo
method it will give you an error when it gets to the end of the file because that's the last point at which you might have put it!
If your code was indented properly - and it isn't, not consistently even in that small sample - it would probably be really obvious. So start off but indenting properly and matching up your open and close brackets.
When you fix that, compile again, and the chances are many of the other error will have gone as well.