• AVR Freaks

Hot!Cannot find include file <xc.h> in 2.05

Author
DeltaElectronics
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2016/06/24 07:25:46
  • Location: 0
  • Status: offline
2019/05/21 12:59:33 (permalink)
0

Cannot find include file <xc.h> in 2.05

Hello,
I recently installed the XC8 v. 2.05 compiler, but the compiler is not able to find file <xc.h> in the statement
#include <xc.h>

This issue does not appear if I use XC8 v. 1.44 compiler..
How to fiz it ?
Advanced thanks
#1

6 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: Cannot find include file <xc.h> in 2.05 2019/05/21 13:13:00 (permalink)
    +2 (2)
    How do you know?
    Because you get compile failures, or because the IDE puts a red squiggle under the name?
    Red squiggles are a "feature" of the crappy IDE, and do not stop the compiler from working.
     

    Nearly there...
    #2
    DeltaElectronics
    Starting Member
    • Total Posts : 53
    • Reward points : 0
    • Joined: 2016/06/24 07:25:46
    • Location: 0
    • Status: offline
    Re: Cannot find include file <xc.h> in 2.05 2019/05/22 03:23:19 (permalink)
    0
    Red squiggles are a "feature" of the crappy IDE, and do not stop the compiler from working

    What are you exactly meaning with crappy IDE ?
    I use the newest MPLAB IDE version....
    #3
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Cannot find include file <xc.h> in 2.05 2019/05/22 03:52:32 (permalink)
    +1 (1)
    I mean that all versions of MPLABX exhibit this problem, and Microchip seem clueless about how to fix it.

    Nearly there...
    #4
    Duncan
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2007/03/27 11:46:12
    • Location: 0
    • Status: offline
    Re: Cannot find include file <xc.h> in 2.05 2019/05/29 06:45:03 (permalink)
    0
    I also have installed v2.05. Using the autogenerated code for a new main:
     
    #include <xc.h>
    void main(void) { return; }
     
    The editor gives the error message "Cannot find include file <xc.h>". Of course the file compiles - it's not using anything that would be referenced in xc.h. I then added a port name, say PORTB = 0xff, the editor underlines PORTB with a squiggly red line - it doesn't recognise it as a port and complains that it's an unresolved identifier. The program still happily compiles and builds without any warnings.
     
    This afternoon I must have restarted my computer, restarted the IDE, deleted the cache countless times and the IDE behaviour has been the same. EXCEPT for one time when it worked, the editor didn't have any errors or warnings and PORTB was recognised. Furthermore I could navigate to xc.h and my pic***.h files by right clicking on xc.h or PORTB and "navigate->go to declaration".
     
    I happen to be retired and can waste time without affecting project timescales - I pity anyone doing this for a job.
    #5
    studiotech
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2018/02/21 09:56:00
    • Location: 0
    • Status: offline
    Re: Cannot find include file <xc.h> in 2.05 2019/06/07 10:35:31 (permalink)
    0
    I too did not see this problem until after upgrading to XC8 2.05.  (I have a semi-workaround; see below.)
     
    It is weird.  With a single project open, some of my C source files show the <xc.h> as a resolved library file (hold CTRL while cursoring over name) while other source files show it unresolved!  Now that is a clever bug!
     
    When this problem arises I have had some success by closing the project ("Close All Projects" on file menu) and then immediately reopening it (File Menu => Open Recent Project ==> select project).  After re-opening, the library files appear to all be resolved (in Editor windows).
     
    But even this does not always work.   Sometimes I need to exit the IDE entirely, restart it, and then perform my Close and re-Open Project sequence to get the automatic library navigations resolved.
     
    Some people say this is an old bug.  Regardless, it is a pain in the a**.
     
     
    #6
    studiotech
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2018/02/21 09:56:00
    • Location: 0
    • Status: offline
    Re: Cannot find include file <xc.h> in 2.05 2019/06/07 11:36:47 (permalink)
    0
    This bugs me so much I dug in again.  I may have a real workaround.  Time will tell, but so far, so good.
     
    NOTE: Using MPLAB X IDE v5.20.  Paths below are for PIC projects.  AVR will be different.
     
    Solution:
    1. Open Project Properties
    2. In the categories tree, select this node:  Conf: [default] => XC8 Global Options => XC8 Compiler
    3. Open the Include Directories dialog:  Click on the text box (of include folders) or the "..." next to it.  You should see a couple folders from your project, for example, "header files", "mcc_generated_files", etc.
    4. Add the following path to the list, as Absolute path entry (use correct path for your own computer):
      C:\Program Files (x86)\Microchip\xc8\v2.05\pic\include
    5. Add just ONE of the following paths to the list, depending on whether you are using C90 or C99 standard:
      C:\Program Files (x86)\Microchip\xc8\v2.05\pic\include\C90
      or
      C:\Program Files (x86)\Microchip\xc8\v2.05\pic\include\C99
    6. Close the dialog
    I have not seen the error or warning icons since adding these to my project. (I am using the C90 standard -- set on the "XC8 Linker" settings window.)
    post edited by studiotech - 2019/06/07 11:47:12
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5