• AVR Freaks

Hot!Problem with joining the library "stdlib.h"

Author
Tabaluga
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2017/08/14 03:54:47
  • Location: Poland
  • Status: offline
2019/03/17 09:18:37 (permalink)
0

Problem with joining the library "stdlib.h"

Hi !
In the code I write, I intend to use the "itoa" function.
The use of this function requires the inclusion of the library "stdlib.h"
Unfortunately, typing #include <stdlib.h> causes the message: "Can not find include file". How should I solve this problem? Thank you in advance for your advice. 
Tabaluga
#1

16 Replies Related Threads

    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/17 12:27:23 (permalink)
    +2 (2)
    Which version of XC8?
    If it is XC8 version 2.x, which mode are you using it in? (C90, or C99)
    That error implies something went wrong when you installed XC8.
     
    Note, I am responding the the actual error message you reported.
    Note that if you are in C99 mode, even if you have succesfully included stdlib.h, it does NOT contain a definition for itoa().
    That is  a non-standard function that was added to stdlib in the HiTech days, and has been carried through to XC8 in C90 mode, but is not there in C99 mode.
    You can google for source code to implement the function, but it will probably be simpler just to switch XC8 back to C90 mode.
    See: http://microchipdeveloper.com/xc8:moving-to-xc8-2-0
     
    post edited by qhb - 2019/03/17 12:35:50

    Nearly there...
    #2
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/17 12:49:13 (permalink)
    +2 (2)
    n.b. the functions that ARE included in each library in C99 mode are listed in Appendix A of the C99 manual (MPLAB_XC8_C_Compiler_User_Guide_for_PIC.pdf)

    Nearly there...
    #3
    Tabaluga
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2017/08/14 03:54:47
    • Location: Poland
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/17 13:26:26 (permalink)
    0
    @qhb 
    Thank you for your interest in my problem. 
    My version of XC8, 2.05. 
    How (where?) can I check the C90 mode or the C99 mode ? 
    Greetings, 
    Tabaluga
    #4
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/17 14:17:07 (permalink)
    +2 (2)
    Tabaluga
    How (where?) can I check the C90 mode or the C99 mode ?

    You read the link that I included in my reply.
    Also note, as documented in that article, you can use C99 mode but with the C90 libraries.
    It's described under "New Driver, C99 Standard, C90 Libraries".
     
    post edited by qhb - 2019/03/17 14:21:18

    Nearly there...
    #5
    NKurzman
    A Guy on the Net
    • Total Posts : 17711
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Problem with joining the library "stdlib.h" 2019/03/17 15:35:15 (permalink)
    +2 (2)
    C90 or C99 mode is in the project compiler settings.
    The default is C99 for a new project.
    #6
    katela
    Super Member
    • Total Posts : 1379
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: online
    Re: Problem with joining the library "stdlib.h" 2019/03/17 15:51:18 (permalink)
    +2 (2)
    Tabaluga
    How (where?) can I check the C90 mode or the C99 mode ? 


    This article explains how to check/change your compiler mode as explained to you in #2: http://microchipdeveloper.com/xc8:moving-to-xc8-2-0
     

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #7
    Tabaluga
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2017/08/14 03:54:47
    • Location: Poland
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/21 12:10:46 (permalink)
    0
    I have read the content available in MPLAB® XC8 C Compiler Moving to the v2.0 (http://microchipdeveloper...c8:moving-to-xc8-2-0). Unfortunately, this manual probably applies to some older versions of MPLABX. I use MPLABX V4.15 and compilers XC8 V1.45 or 2.05 and described there (http://microchipdeveloper../xc8:moving-to-xc8-2-0) hints I can not apply to version 4.15, because unfortunately it looks like otherwise. Should I return to an older version of MPLABX to apply the MPLAB® XC8 C Compiler Moving to the v2.0 instruction ?
    #8
    du00000001
    Just Some Member
    • Total Posts : 3005
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/21 12:20:52 (permalink)
    0
    What's your OS?
    What are your display settings?
     
    Even if the screenshots look somewhat different, you should be capable to identify the Project Properties | XC8 Global Options | Option Categories | ...

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #9
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/21 12:33:09 (permalink)
    +3 (3)
    Tabaluga
    I have read the content available in MPLAB® XC8 C Compiler Moving to the v2.0 (http://microchipdeveloper...c8:moving-to-xc8-2-0). Unfortunately, this manual probably applies to some older versions of MPLABX. I use MPLABX V4.15 and compilers XC8 V1.45 or 2.05 and described there (http://microchipdeveloper../xc8:moving-to-xc8-2-0) hints I can not apply to version 4.15, because unfortunately it looks like otherwise. Should I return to an older version of MPLABX to apply the MPLAB® XC8 C Compiler Moving to the v2.0 instruction ?

    What are you seeing?
    I tried this in MPLABX 5.10, and apart from different fonts to the example, it is exactly the same.
    It sounds more like you are going to the wrong place in the setup screen. Pay attention to details.
     
     

    Nearly there...
    #10
    mad_c
    Super Member
    • Total Posts : 1193
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/21 14:15:38 (permalink)
    +2 (2)
    Tabaluga
    I have read the content available in MPLAB® XC8 C Compiler Moving to the v2.0 (http://microchipdeveloper...c8:moving-to-xc8-2-0). Unfortunately, this manual probably applies to some older versions of MPLABX. I use MPLABX V4.15 and compilers XC8 V1.45 or 2.05 and described there (http://microchipdeveloper../xc8:moving-to-xc8-2-0) hints I can not apply to version 4.15, because unfortunately it looks like otherwise. Should I return to an older version of MPLABX to apply the MPLAB® XC8 C Compiler Moving to the v2.0 instruction ?


    That guide was written using probably IDE v5.10, or something around that time. You say you are using IDE v4.15. Do you mean 5.15? There has not been a lot of change to the project properties in the last few IDE versions, but remember that when you swap a project from using a v1.xx compiler to a v2.xx compiler, the options dialogs will change significantly to match the change in the compiler.
     
    Jeff.
    #11
    Tabaluga
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2017/08/14 03:54:47
    • Location: Poland
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/22 00:53:35 (permalink)
    0
    Here's what I see:
    https://pasteboard.co/I6MOOwV.png 
    post edited by Tabaluga - 2019/03/23 11:32:10
    #12
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/22 01:09:55 (permalink)
    +2 (2)
    So you are working on a project that has XC8 1.xx selected.
    You have to select XC8 version 2.x as the compiler first.
     
     

    Nearly there...
    #13
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/22 01:09:56 (permalink)
    +1 (1)
    So you are working on a project that has XC8 1.xx selected.
    You have to select XC8 version 2.x as the compiler first.
     
     

    Nearly there...
    #14
    Tabaluga
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2017/08/14 03:54:47
    • Location: Poland
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/23 12:04:17 (permalink)
    0
    @ qhb 
    No matter which version of the installed compiler ( 1.45 or 2.05 ) I choose, the effect is always the same. Please look at these links. 
    https://pasteboard.co/I6MWeLP.png  
    https://pasteboard.co/I6MWPBlO.png  
    https://pasteboard.co/I6MZhKg.png 
    #15
    Tabaluga
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2017/08/14 03:54:47
    • Location: Poland
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/23 13:20:56 (permalink)
    0
    I think I've already exhausted all the possibilities of experimenting with different versions of the XC8 compiler. Currently, I installed the latest  version 5.15 MPLABX. I will test and check whether this change will solve my problems. After trying the new version of MPLABX I will write what I managed to achieve.
    #16
    Tabaluga
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2017/08/14 03:54:47
    • Location: Poland
    • Status: offline
    Re: Problem with joining the library "stdlib.h" 2019/03/25 11:32:10 (permalink)
    0
    Installing MPLABX v5.15 and MCC v3.75 solved all problems.
    Thank you very much to all colleagues who expressed interest in my troubles and served helpful advice. 
    Smile: Smile
    #17
    Jump to:
    © 2019 APG vNext Commercial Version 4.5