Yep. So in main.c you have:
Char *gJay="Jay"; ... and in Information.c you have: extern Char *gJay; Kind regards, Brian On Thu, 18 Apr 2002 09:34:28 -0500, Palm Developer Forum <[EMAIL PROTECTED]> said: >Thanks Brian, >Do you mean I declared it correctly and in addition I >need to put the code you suggested in each of the .c >files? >Jay > > >>From Brian: > >In the other sources (not main.c): > >extern Char *gJay; > > > > >>Creating a global variable: >> >>I tried to create a global variable and test to see the >>scope of that variable >>in a custom alert. So I created a variable called >>gJay. >> >> >>Char * gJay = "Jay"; >> >>When I put this code in the main.c file (the file that >>has the MainFormInit function in it) >>below the # includes >>above the functions >>right where it says Global Variables >>right below where the preferences were declared >> >>no compile errors >> >> >>When I put code in to read the value of that variable >>gJay in another .c file within the project >>(Information.c) >>Then I get a compile error. I get an undefined >>identifier error. It reads all other information from >>this file correctly. >> >> >>So I moved the declaration to the main header file. >>When I attempt to compile I get a Link error. >> >>LengthWeight.c Global object gJay was already declared >>in file Information.c >>Utility.c Global object gJay was already declared in >>file Information.c >>Main.c Global object gJay was already declared in file >>Information.c >>Utility.c Global object gJay was already declared in >>file Information.c >>About.c Global object gJay was already declared in file >>Information.c >> >>Information.c only attempts to use the variable. It is >>declared in the header and used in the Information.c >>file. >> >> >>I know the project is seeing the variable as I have my >>global variable colored light blue and when I type in >>gJay it turns light blue. >> >>Any help would be appreciated. Jay > >-- >For information on using the Palm Developer Forums, or to unsubscribe, please see >http://www.palmos.com/dev/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
