Local variables are local to the function you declare them in. If you declare something in main, gameLoop has now knowledge about it.
One solution would be to move the two variables to global scope. Then they would be visible form all functions. It's not great to use globals though. You'll know when your programs get larger.
A better solution would be to either pass those two variables to gameLoop as arguments (by reference) or use put them, and gameLoop in a class. If you don't know how to do either, go with a globals. You'll have time to learn.