#ifndef

General discussion on mikroC.
Post Reply
Author
Message
gambrose
Posts: 369
Joined: 28 Sep 2004 17:34
Location: uk

#ifndef

#1 Post by gambrose » 27 Feb 2005 17:58

Can the #ifndef be used with macros?

I have the following code:

Code: Select all

#ifndef Printf_Output(character)
     #define Printf_Output(character) asm nop;


which generates this error:

[quote]f:/microc code/printf/printf_formatter.h:3: error: Excessive token sequence "(character)"
    #ifndef Printf_Output(character)
    from F:/MicroC code/Printf/Short2Ascii.c: 1:    #include "Printf_Formatter.H"
1 error in preprocessor.[/quote]

when i have this code:

[code]#define Printf_Output(character) LCD_Chr_CP(character);


in my main program file.
Graham Ambrose

nikola
mikroElektronika team
Posts: 137
Joined: 03 Aug 2004 12:44
Contact:

Re: #ifndef

#2 Post by nikola » 28 Feb 2005 18:12

gambrose wrote:Can the #ifndef be used with macros?
Yes, they can. The code you need is:

Code: Select all


  #define Printf_Output(character) asm nop;


You were close :wink:

--
best regards,
Nikola

gambrose
Posts: 369
Joined: 28 Sep 2004 17:34
Location: uk

#3 Post by gambrose » 28 Feb 2005 18:38

Thanks but I still have a problem

I have a C file with a formatter function in it that outputs to Printf_Output

This has a header file which includes

#define Printf_Output(character) asm nop;


But when I use



In the main C file it dose not load the LCD_Chr_CP function so I assume it is not passing the #define of Printf_Output to formatter header file.

(it works fine with #define Printf_Output(character) LCD_Chr_CP(character); in the formatter header file)

Am I correct in thinking this is what should be happening?
Graham Ambrose

Bangon Kali
Posts: 10
Joined: 20 Sep 2012 08:27

Re: #ifndef

#4 Post by Bangon Kali » 08 Mar 2013 14:45

This may help.

Post Reply

Return to “mikroC General”