Hello all,
I am learning C++ on MAC using Xcode. I have a file .cpp and want to define a global variable xglob (for all the functions in that file). It seems so simple and all I should do (according to the manual I am following) is to put "int xglob" before "int main () ". but when I do that and use xglob even in the main() function, the compiler gives me the error message that :
"xglob was not declared in this scope". I have only "#include <iostream>" and "using namespace std" at the top of my simple program. I am stuck with this simple matter. Could you please help me resolve it?
Thanks.
I am learning C++ on MAC using Xcode. I have a file .cpp and want to define a global variable xglob (for all the functions in that file). It seems so simple and all I should do (according to the manual I am following) is to put "int xglob" before "int main () ". but when I do that and use xglob even in the main() function, the compiler gives me the error message that :
"xglob was not declared in this scope". I have only "#include <iostream>" and "using namespace std" at the top of my simple program. I am stuck with this simple matter. Could you please help me resolve it?
Thanks.