Sorry for the simple question. Everything works, thanks. --- In lpc2000@yahoogroups.com, balaji cr <balaji_c_r@y...> wrote: > Hi, > Have you tried using 'extern'? > > For example in file1.c, you have a global variable > > int global_var; > > In all other files say file2.c and file3.c, you can > use it as: > > extern int global_var; > > Google for more help. You may find more info and some > good books too. > > Cheers, > Balaji > > --- lehighuboy <garrett.j.young@g...> wrote: > > > > > The code is segmented to several C files by > > function, and a few > > variables are shared across functions. I defined > > those variables in > > the first compiled C file, however the other > > functions in subsequent > > files doesn't see them during the compile. I rather > > not lump > > everything into one file therefore I wanted to > > define global > > variables for all C files. > > > > Thanks, Garrett > > > > --- In lpc2000@yahoogroups.com, "Anton Erasmus" > > <antone@s...> wrote: > > > On 25 Sep 2005 at 4:11, lehighuboy wrote: > > > > > > > The following question involves an LPC2129 and > > Keil ARM IDE, AA > > and > > > > CARM compiler. > > > > > > > > Are global variables defined in the startup.s > > file? And, if that's > > > > correct, then where should the code be placed? > > Finally, how would > > you > > > > define a global float, unsigned int, char, and > > const char > > variables? > > > > (please respond with examples) > > > > > > > > Thank you for your help! > > > > > > > Why would you want to define global variables in > > the startup.s > > file ? > > > Define them as you would when writing normal C > > code. The only thing > > > the startup.s file does, is to setup a suitable > > environment for the > > C > > > application to run in, as defined in Standard C. > > > > > > Regards > > > Anton Erasmus > > > -- > > > A J Erasmus > > > > > > > > > Dream is just a dream. A goal is a dream with a plan and a deadline. > - Harvey Mackay
Message
Re: Global Variables
2005-09-25 by lehighuboy
Attachments
- No local attachments were found for this message.