Hi all. As I said, I'm pretty much a total newcomer to programming of any type. I'm going through Kochan's textbook on Objective-C, and I've come to the section on variable scope. In that section, there's an example in which a global integer variable called "gGlobalVar" is declared in "main.m". Then, in one of the classes that's imported into "main.m", there's a method (setgGlobalVar) that declares "gGlobalVar" as an external variable and sets its value to 100.
I've gone ahead and plugged Kochan's example into Xcode, but when I go to compile it, I end up getting an error message about an undefined symbol called "_gGlobalVar". I know that somewhere along the way, an underscore gets slapped on the front of the variable name, but I don't know how to account for this and deal with it so that the program actually compiles and runs without any problems.
Any advice to get me over this would be awesome. Thanks.
I've gone ahead and plugged Kochan's example into Xcode, but when I go to compile it, I end up getting an error message about an undefined symbol called "_gGlobalVar". I know that somewhere along the way, an underscore gets slapped on the front of the variable name, but I don't know how to account for this and deal with it so that the program actually compiles and runs without any problems.
Any advice to get me over this would be awesome. Thanks.