rikotech
New Member
- Total Posts : 30
- Reward points : 0
- Joined: 2012/07/10 09:56:05
- Location: 0
- Status: offline
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?
|
btbass
Super Member
- Total Posts : 362
- 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)
You don't need the 'extern'
|
qhb
Superb Member
- Total Posts : 9999
- 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)
rikotech receiver.c #include "receiver.h" void receiver_init(){ self.cb.head = 0; self.cb.tail = 0; }
void receiver_init(){ should bevoid receiver_init(void){
|
rpg7
Super Member
- Total Posts : 1424
- 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)
should be void receiver_init(void) { you need the void in the actual function, not just the header
|
rikotech
New Member
- Total Posts : 30
- 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)
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.
|
1and0
Access is Denied
- Total Posts : 11768
- 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)
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.
|
rikotech
New Member
- Total Posts : 30
- 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)
Apologize you guys @ 1and0 @ rpg7 @ qhbYou are right! I think the compiler could imply void argument list from the empty parenthesis.
|
1and0
Access is Denied
- Total Posts : 11768
- 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)
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.
|
du00000001
Just Some Member
- Total Posts : 4074
- 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)
@ 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)
|
Jim Nickerson
User 452
- Total Posts : 6845
- 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)
I do trust the compiler does not "imply" anything, but follows strict rules.
|
mlp
boots too small
- Total Posts : 992
- 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)
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)
|
du00000001
Just Some Member
- Total Posts : 4074
- 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)
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)
|
NKurzman
A Guy on the Net
- Total Posts : 19112
- Reward points : 0
- Joined: 2008/01/16 19:33:48
- Location: 0
- Status: online
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)
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.
|
du00000001
Just Some Member
- Total Posts : 4074
- 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)
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)
|
crosland
Super Member
- Total Posts : 2145
- Reward points : 0
- Joined: 2005/05/10 10:55:05
- Location: Warks, 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)
btbass You don't need the 'extern'
Well, it's nearly panto season "Oh yes you do!"
|
Alexmouse
New Member
- Total Posts : 21
- Reward points : 0
- Joined: 2009/07/06 03:13:29
- Location: UK
- Status: offline
Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call
2019/07/05 08:32:20
(permalink)
I just got this error in MPLABX5.20, XC8 2.05 In the MCC-generated code (ADCC.C/H), the function bool ADCC_IsConversionDone() is defined. Making this bool ADCC_IsConversionDone(void) fixes the error. Buggy tools? Now there's a novelty.
|
du00000001
Just Some Member
- Total Posts : 4074
- 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
2019/07/05 08:37:56
(permalink)
@ Alexmouse For conquering some thread I'll call the cat !
PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
|
InvalidApple
Super Member
- Total Posts : 296
- Reward points : 0
- Joined: 2011/05/17 23:36:35
- Location: Melbourne, Australia
- Status: offline
Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call
2019/07/06 03:51:41
(permalink)
Section 6.11.6 of the C99 standards says that it is a "future language direction", but for now... 6.7.5.3 Function declarators (including prototypes) 4 - After adjustment, the parameters in a parameter type list in a function declarator that is part of a definition of that function shall not have incomplete type. Edit/ Also C99 Annex J.2 Undefined behavior For a call to a function without a function prototype in scope, the number of arguments does not equal the number of parameters (6.5.2.2). For call to a function without a function prototype in scope where the function is defined with a function prototype, either the prototype ends with an ellipsis or the types of the arguments after promotion are not compatible with the types of the parameters (6.5.2.2). For a call to a function without a function prototype in scope where the function is not defined with a function prototype, the types of the arguments after promotion are not compatible with those of the parameters after promotion (with certain exceptions) (6.5.2.2).
post edited by InvalidApple - 2019/07/06 04:01:57
|
ric
Super Member
- Total Posts : 29471
- Reward points : 0
- Joined: 2003/11/07 12:41:26
- Location: Australia, Melbourne
- Status: online
Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call
2019/07/06 04:56:04
(permalink)
Bottom line, a lazy MCC programmer omitted the "void" parameter from bool ADCC_IsConversionDone()
To get a useful answer, always state which PIC you are using!
|