• AVR Freaks

warning implicit declaration of function with C30 in MPLABX (Mystery Solved)

Author
dlc@frii.com
Super Member
  • Total Posts : 382
  • Reward points : 0
  • Joined: 2006/03/03 10:49:45
  • Location: Colorado
  • Status: offline
2019/11/14 14:44:10 (permalink)
0

warning implicit declaration of function with C30 in MPLABX (Mystery Solved)

My pardons if this is a duplication, but there was a doubt that I posted this the first time.  So just to be sure...
 
Details:
PIC24FJ64GA002
MPLAB X 5.25
C30 3.31
Windows 10 Enterprise
 
EDIT: Skip to the "solution"
**********************
The problem has nothing to do with C30, in fact it looks like the warning comes before the compiler is even called, which I did not notice at first.  This is a quirk of the IDE.  Any code that uses a #include that is not directly in the code file looks undefined to the IDE.  Similarly (This is conjecture), it looks like a #include that is for a .h file that was already included in some other file, may trigger the usual "#ifndef" block that surrounds the contents of the .h file, thereby not allowing the IDE to read the defines in that .h file for that code (.c) file.
Because this is an oddity of the IDE, I am now ignoring it.  This is conjecture which explains the behavior I see.  I do not have time to gerrymander my code to align the #include files for the IDE, so I will ignore the warning.  If anyone has a better explanation, I am all ears.  :)
 **********************
 
Yes, this is C30, not XC16.  I am migrating from legacy MPLAB 8 projects to MPLAB X and I only want to debug one thing at a time instead of the IDE, compiler, linker, etc. all at once.
 
I faithfully followed the MPLAB 8 to MPLAB X migration tutorial and am getting this warning with this project:
../Depth.c: In function 'DeviceCalibrate':
../Depth.c:281: warning: implicit declaration of function 'RetardClock'
The function 'RetardClock' is also called from another function in this source file, and from that function, no warning is issued.
 
I have the relevant .h file in the projects header files list, I have the #include of the .h file (timers.h) in my source code, and the IDE has properly referenced the folders where this source lies.  This compiler does not give this warning in my MPLAB 8 project.  I have successfully migrated four other projects without warnings. This one is the first to give me trouble.
 
The program works fine in the device as far as I can tell right now.  I just do not like inexplicable warnings coming from my compiler.
 
Does anyone have an idea about what I might be missing that gives me this warning?  I am all ears (eyes)!
post edited by dlc@frii.com - 2019/11/20 14:59:12

Dennis Clark
dlc@frii.com
#1

2 Replies Related Threads

    ric
    Super Member
    • Total Posts : 24581
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: warning implicit declaration of function with C30 in MPLABX 2019/11/14 15:13:28 (permalink)
    0
    Where is the code for this function "RetardClock" ?
    Is there a prototype for it in this header file you mention?
    Can only guess when you don't show the actual files involved.
     

    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
    dlc@frii.com
    Super Member
    • Total Posts : 382
    • Reward points : 0
    • Joined: 2006/03/03 10:49:45
    • Location: Colorado
    • Status: offline
    Re: warning implicit declaration of function with C30 in MPLABX 2019/11/14 15:43:34 (permalink)
    0
    ric
    Where is the code for this function "RetardClock" ?
    Is there a prototype for it in this header file you mention?
    Can only guess when you don't show the actual files involved.
     

    The code is in the timers.c file, which is accompanied by its timers.h file, which does indeed have the function prototyped and which is #included in the "caller" file.  I have to be careful about sharing the code in a public forum for this project and so would have to hack it up so much it might not mean anything to another reader.  But if you think it will help, I can sure give it a try. 
     
    I have several projects showing in the projects window, but only compile the main project.  Another project uses the same core files in the exact same manner, and that did not give me the warning.  Would having two projects open, even if only building the "main" project be an issue?
     
    [deleted the source code so as not to litter the forum with it.]
     
    Thanks for your time!
    post edited by dlc@frii.com - 2019/11/20 15:00:31

    Dennis Clark
    dlc@frii.com
    #3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5