Hot!Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call mad

Author
rikotech
New Member
  • Total Posts : 25
  • Reward points : 0
  • Joined: 2012/07/10 09:56:05
  • Location: 0
  • Status: offline
2018/10/15 03:12:16 (permalink)
0

Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call mad

The warning is: main.c:95:: [<font]warning: (1518) direct function call made with an incomplete prototype (receiver_init)
main.c
#include "modules/receiver/receiver.h"
void main_init(void){
receiver_init();
}
 
receiver.h
extern void receiver_init(void); // If remove void from parenthesis - same sh*t
 
receiver.c
#include "receiver.h"
void receiver_init(){ 
self.cb.head = 0;
self.cb.tail = 0; 
}
 
Some help please?
#1

14 Replies Related Threads

    btbass
    Super Member
    • Total Posts : 357
    • Reward points : 0
    • Joined: 2004/12/10 13:50:32
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 03:54:30 (permalink)
    0
    You don't need the 'extern'
    #2
    qhb
    Superb Member
    • Total Posts : 9612
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 04:03:01 (permalink)
    +1 (1)
    rikotech
     
    receiver.c
    #include "receiver.h"
    void receiver_init(){ 
    self.cb.head = 0;
    self.cb.tail = 0; 
    }

    void receiver_init(){ 

    should be
    void receiver_init(void){ 

    #3
    rpg7
    Super Member
    • Total Posts : 1372
    • Reward points : 0
    • Joined: 2003/11/07 12:47:35
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 04:06:03 (permalink)
    +1 (1)
    should be
    void receiver_init(void) {
    you need the void in the actual function, not just the header
    #4
    rikotech
    New Member
    • Total Posts : 25
    • Reward points : 0
    • Joined: 2012/07/10 09:56:05
    • Location: 0
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 07:07:12 (permalink)
    0
    Sorry guys. None of the above make sense to me but here is what I found.
    The MPLAB X IDE v5.05 seems to have a bug! Does not remake source files when some of the included header files is changed. Clean and Build is workaround. 
    #5
    1and0
    Access is Denied
    • Total Posts : 8842
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 08:01:59 (permalink)
    +2 (2)
    This declaration
    void receiver_init()

    can accept any arguments. As others said, the correct declaration is
    void receiver_init(void)

    which is a function without arguments.
    #6
    rikotech
    New Member
    • Total Posts : 25
    • Reward points : 0
    • Joined: 2012/07/10 09:56:05
    • Location: 0
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 08:28:10 (permalink)
    -1 (1)
    Apologize you guys @1and0 @rpg7 @qhb
    You are right! I think the compiler could imply void argument list from the empty parenthesis.
     
    #7
    1and0
    Access is Denied
    • Total Posts : 8842
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 08:40:39 (permalink)
    +1 (1)
    rikotech
    I think the compiler could imply void argument list from the empty parenthesis.

    With an empty () it is telling the compiler not to do any checks on the parameters list.  That is, this
      receiver_init();

    and this
      receiver_init(foo,bar,baz);

    will work.
     
    #8
    du00000001
    Just Some Member
    • Total Posts : 2546
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 09:31:11 (permalink)
    +1 (1)
    @ rikotech
     
    Compilers do not "imply" anything. They follow the written characters and some "fancy" rules about type promotion. That's it.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #9
    Jim Nickerson
    User 452
    • Total Posts : 5842
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 10:35:32 (permalink)
    +1 (1)
    I do trust the compiler does not "imply" anything, but follows strict rules.
    #10
    mlp
    boots too small
    • Total Posts : 709
    • Reward points : 0
    • Joined: 2012/09/10 15:12:07
    • Location: previously Microchip XC8 team
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/16 07:46:10 (permalink)
    +2 (2)
    rikotech
    I think the compiler could imply void argument list

    As others have said, the compiler does not "imply".
     
    It also does not "infer", which is the word you actually meant to use for "deduce or conclude (information) from evidence and reasoning rather than from explicit statements".
     
    To "imply" is to "strongly suggest the truth or existence of (something not expressly stated)".

    Mark (this opinion available for hire)
    #11
    du00000001
    Just Some Member
    • Total Posts : 2546
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/16 12:58:25 (permalink)
    +1 (1)
    Compilers do not even "try some educated guess" if your code is not absolutely clear and free from errors. Instead they simply throw warnings and errors.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #12
    NKurzman
    A Guy on the Net
    • Total Posts : 17127
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/16 18:40:00 (permalink)
    0
    du00000001
    Compilers do not even "try some educated guess" if your code is not absolutely clear and free from errors. Instead they simply throw warnings and errors.


    Except for GCC Compilers They do Try some educated Guesses and Do Not warn you.
    #13
    du00000001
    Just Some Member
    • Total Posts : 2546
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/16 18:46:18 (permalink)
    0
    Not exactly my experience.
    Once MPLAB/XC8 threw a mysterios error. Now I tend to sometimes have doxygen (resp. Clang) check my code as well: gives useful additional insights.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #14
    crosland
    Super Member
    • Total Posts : 1559
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Bucks, UK
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/17 01:55:22 (permalink)
    0
    btbass
    You don't need the 'extern'


    Well, it's nearly panto season "Oh yes you do!"
     
    #15
    Jump to:
    © 2019 APG vNext Commercial Version 4.5