IPB

Welcome Guest ( Log In | Register )

> #define Problem
Edward Mulder
post Nov 22 2007, 09:51 PM
Post #1


Newbrie


Group: EstablishedMember
Posts: 5
Joined: 22-November 07
Member No.: 3,904



Hi all,

I want to use a define when debugging my program. I have a UART routine that waits
for an interrupt. When debugging, I want to skip that line. The structure of my program
is like this:

main.c

#define DEBUG
#include "serial.h"

void main()
{
}


serial.c

void ser_printf(char value)
{
#ifdef DEBUG
return;
#endif
while ((txsta & 1 << TRMT) == 0) ;
txreg = value;
}


In the project part I have incuded the serial.c file, but now the problem:
the reference to DEBUG in the serial.c file does not "see" the DEBUG
declaration in the main.c file

What can I do to control the ser_printf function from the main file? I do
not want to make changes to the serial.c file every time I want to debug.

Thanks,

Edward
update SourceBoost release 6.97 is available.
Download Now
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
Edward Mulder
post Nov 24 2007, 02:57 PM
Post #2


Newbrie


Group: EstablishedMember
Posts: 5
Joined: 22-November 07
Member No.: 3,904



@Pavel:

That's it. Adding -d DEBUG to the compiler options does exactly what I want.
Thanks very much.

Edward
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 3rd September 2010 - 02:47 PM