your in way over your head. following step by step is similar to copy/paste when your just writing down everything that happens in the video, take a few steps back and work your way up, will make life alot easier.
First, how can we get your problems if you don't show us the whole code.
Post it on a pastebin.
And second, try to look at the message errors and google them up.
Undefined reference might be caused by the compiler and the .o file, the compiler can't link it.
Or you haven't defined those variables, you may forgot to use libraries "#include ...".