Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/23/03 07:02
Read: times


 
#46455 - Keil C51 <i>#define</i> scope
I wasted several hours on Keil's website trying to answer this. Hopefully one of you guys can make short work of it:

Can I make a symbol that is defined in my main.c (using #define) globally accessable by all project files? My lab board can accept either a P89C51RD2 or a DS89C420, and I would like to compile code for both MCU's from the same project files with minimal changes.

Here are the top two lines of my main.c code:

#define P89C51RD2
//#define DS89C420

I use the #ifdef directive throughout the code for conditional compiling, but it only works when all the code is in main.c. The symbols defined by #define appear to be local to the file they are declared in. Can I make it global?

- Lee

BTW, notice that HTML tags work in the subject line!

List of 6 messages in thread
TopicAuthorDate
Keil C51 <i>#define</i> scope            01/01/70 00:00      
   Answered my own question..            01/01/70 00:00      
      RE: Answered my own question..            01/01/70 00:00      
         RE: Answered my own question..            01/01/70 00:00      
            RE: Keil            01/01/70 00:00      
      RE: Answered my own question..            01/01/70 00:00      

Back to Subject List