![]() |
Global variable question
If I create a global variable in one .c file, can I access this variable from another .c file?
I thought so, but I get the error "symbol 'varname' has not been defined." Thanks, Nathan |
Re: Global variable question
In one file, define it like this:
Code:
int foo;Code:
extern int foo; |
Re: Global variable question
Great, thanks!
Nathan |
Re: Global variable question
A simple way to make sure this works in all files is to add this to a header (.h) file:
Code:
#ifdef DEFINE_VARSI hope this helps. |
| All times are GMT -5. The time now is 23:49. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi