• AVR Freaks

Hot!too few arguments provided to function-like macro invocation

Author
yrdevram
New Member
  • Total Posts : 11
  • Reward points : 0
  • Joined: 2020/03/15 21:52:40
  • Location: 0
  • Status: offline
2020/07/04 21:46:32 (permalink)
0

too few arguments provided to function-like macro invocation

Hello friends,
         
          I am facing this problem:    "test.c:96:19: error: too few arguments provided to function-like macro invocation"
while working with MPLAB X.
 
#define eeprom_write(addr, value) (Busy_eep(), Write_b_eep(addr,value))
 
at this line when function called
 
void eeprom_write();
 
code is:
 
#ifdef _DISABLE_EEPROM_FUNCTIONS
#define eeprom_read(addr) 0
#define eeprom_write(addr, value)
#else
_NO_PLIB_SUPPORT(Read_b_eep) unsigned char Read_b_eep(unsigned int badd);
_NO_PLIB_SUPPORT(Busy_eep) void Busy_eep(void);
_NO_PLIB_SUPPORT(Write_b_eep) void Write_b_eep(unsigned int badd, unsigned char bdat);
#define eeprom_read(addr) Read_b_eep(addr)
#define eeprom_write(addr, value) (Busy_eep(), Write_b_eep(addr,value))
#endif
 
 
thanks.
#1

4 Replies Related Threads

    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: too few arguments provided to function-like macro invocation 2020/07/04 21:54:40 (permalink)
    +1 (3)
    The macro clearly wants two arguments
    addr, value
    but you are trying to call it without supplying any parameters.
     
    The error message is telling you that you didn't supply the required arguments.
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    yrdevram
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2020/03/15 21:52:40
    • Location: 0
    • Status: offline
    Re: too few arguments provided to function-like macro invocation 2020/07/04 22:06:05 (permalink)
    0
    ric
    The macro clearly wants two arguments
    addr, value
    but you are trying to call it without supplying any parameters.
     
    The error message is telling you that you didn't supply the required arguments.
     
     


    Hey ric,
    thanks for quick responce I'll check it.
    #3
    NorthGuy
    Super Member
    • Total Posts : 6228
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: too few arguments provided to function-like macro invocation 2020/07/05 06:56:01 (permalink)
    +1 (1)
    Whoever designed these macros expected you to provide implementations for Busy_eep(), Read_b_eep(), and Write_b_eep() functions, if not already there. Instead, you decided to declare eeprom_write() function of your own. It's either the macro or the function, but not both.
    #4
    Jan Audio
    Senior Member
    • Total Posts : 159
    • Reward points : 0
    • Joined: 2018/09/24 08:12:24
    • Location: 0
    • Status: online
    Re: too few arguments provided to function-like macro invocation 2020/07/05 07:42:19 (permalink)
    0
    Always write your own macros.
    Macros make things understandable for yourself.
    Macros also can make code compicated to read.
    You have to fully understand your macros.
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5