• AVR Freaks

Hot!MPLAB x IDE: Cannot find xc.h

Author
Robin66
New Member
  • Total Posts : 12
  • Reward points : 0
  • Joined: 2016/05/24 12:04:24
  • Location: 0
  • Status: offline
2019/03/30 09:11:10 (permalink)
4 (1)

MPLAB x IDE: Cannot find xc.h

MPLAB x IDE v5.15
xc16 v1.31
 
I'm trying to work out why auto-complete isn't working in mplab and I'm guessing it's due to the redness on my include directives.  the message is "Cannot find include directive <xc.h>."  See <include.jpg>
 
However my code compiles fine, so the required files obviously are found.  Does anyone have any idea what I can do to resolve this?
 

Attachment(s)

Attachments are not available: Download requirements not met
#1

14 Replies Related Threads

    qhb
    Superb Member
    • Total Posts : 9999
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/03/30 23:47:54 (permalink)
    +1 (1)
    The most common suggestions are:
    [1] Rebuild your project.
    [2] Exit and restart MPLABX
    [3] Delete all the files in the MPLABX cache folders. There are two, and they are listed in the MPLABX "Help | About" screen.
     

    Nearly there...
    #2
    Robin66
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2016/05/24 12:04:24
    • Location: 0
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/03/31 13:02:28 (permalink)
    0
    Thanks for taking the time to reply and especially pointing out where the cache directories are. In trying to fix this issue I'd already come across [3] but I didn't know where the dirs were.
     
    I do [1] every few minutes while coding.  I've done [2] multiple times.  And I tried [3] for the first time but unfortunately the problem remains.  I'll keep an eye on the IDE boards because it seems to be a common problem.
    #3
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 4003
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/03/31 19:14:24 (permalink)
    +1 (3)
    Disable or remove the spell-checker plug-in to remove those red underlines.
    It's just an annoyance.
     

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #4
    Javier Lopez
    Pulsotron designer
    • Total Posts : 67
    • Reward points : 0
    • Joined: 2019/02/27 09:59:32
    • Location: Spain
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/04/01 04:47:51 (permalink)
    0
    Thank you, the spell checker was my problem
    #5
    decostern
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2012/11/02 05:09:19
    • Location: 0
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/06/07 01:05:35 (permalink)
    0
    Hello,

       Just installed MPLAB X IDE v5.20 and XC8 V2.05 under linux (OpenSuse) and got the same problem... a "Cannot find include file <xc.h>" and other #include <xxx.h> (while the #include "xxx.h" work).

        It compiles and everything, so the files are apparently found. Not a big issue then, but very annoying while working.
     
        I did try to inactivate the spellchecker but it didn't work. (and I actually do prefer to keep it active)
     
        Any genius idea?

    PS : I first got an error when compiling but that was apparently due to the /opt/microchip/xc8/v2.05/pic/bin/clang that was root owned and with no executable rights for users (just did a chmod a+x on it as root, and it fixed the problem). Probably no link, just saying in cas it might pop an idea.
    #6
    Ardenuf
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Joined: 2019/06/07 08:50:26
    • Location: 0
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/06/09 13:43:30 (permalink)
    0
    After noticing this exact same problem with both my desktop and laptop after upgrading to V5.20, I took some time to see what might be causing this issue.
    It appears that in V5.20 'live parsing' might not be setup to look in the correct location for the inbuilt compiler header files, <xc.h> <stdio.h> etc.
     
    While an official fix is forthcoming, either manually add the required paths to the 'c include dirs' option of 'Project Properties', or copy the header files to the place where Mplab is actually looking for them. Both these workarounds are a bit of a hack so proceed at your own risk.
    #7
    jkelleher
    Starting Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2014/11/21 10:02:11
    • Location: 0
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/06/12 07:06:46 (permalink)
    +3 (3)
    Well here's the steps I found to get rid of this annoying issue, it has to be done every time you start the IDE/Project
    1.  You must do this! - Right Click Hold Project and select properties, then click OK
    2.  Right Click Hold Project and Select Code Assistance->Reparse Project
     
    I have found this to rehook all the includes in the IDE warnings.
    #8
    AjackLue
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2019/06/17 02:54:44
    • Location: 0
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/06/19 00:35:56 (permalink)
    0
    1.  You must do this! - Right Click Hold Project and select properties, then click OK
    2.  Right Click Hold Project and Select Code Assistance->Reparse Project

    >> It's exactly what I need!LoL: LoL
    #9
    wortinguk
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2019/06/12 05:41:15
    • Location: Andover UK
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/11/25 07:07:34 (permalink)
    0

    When is Microchip going to respond to this MPLAB X issue?

    extracts from my project...
    #include <xc.h>  //shows "cant find include file <xc.h>" underlined in red
    #include <stdint.h> //same
    volatile uint16_t   timeCount = 0; //shows "unable to resolve uint8_t" underlined in red
    OSCCONbits.IRCF = 0b1110; //shows "unable to resolve OSCCONbits" underlined in red
    etc....
     
    Apart from that....
    - No auto complete.
    - screen full of red underlines on anything to do with the includes.
     
    But... it compiles OK ? huh?

    Sometime, but rarely, those visual errors all go, for a while.  
    Spell checker is disabled in plugins, but never changed my symptoms.
     
    Project is for a PIC12F1501 using XC8
     

    Product Version: MPLAB X IDE v5.20
    Java: 1.8.0_181; Java HotSpot(TM) 64-Bit Server VM 25.181-b13
    Runtime: Java(TM) SE Runtime Environment 1.8.0_181-b13
    System: Windows 10 version 10.0 running on amd64; Cp1252; en_GB (mplab)
    User directory: C:\Users\wortinguk\AppData\Roaming\mplab_ide\dev\v5.20
    Cache directory: C:\Users\wortinguk\AppData\Local\mplab_ide\Cache\dev\v5.20\var

    XC8 2.05 free
     
     
    Dave "pissed off" Harris
    #10
    ric
    Super Member
    • Total Posts : 28660
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: MPLAB x IDE: Cannot find xc.h 2019/11/25 17:41:28 (permalink)
    0
    wortinguk
    ...
    But... it compiles OK ? huh?

    The compiler knows where to find the files.
    It's just the crappy third party IDE that gets confused.
    Things got worse in XC8 v2 where the include folders all moved down one level to allow for "AVR" and "PIC" variants.
    Microchip really seem clueless about how to fix this.
     

    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!
    #11
    wortinguk
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2019/06/12 05:41:15
    • Location: Andover UK
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/11/26 01:28:56 (permalink)
    0
    Thanks ric. 
    I've tried turning of half of windows to get around this.
    But I should not have to be doing that sh1t.

    Does anyone know of a good IDE for C on PIC?

     
    Dave
    #12
    wortinguk
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2019/06/12 05:41:15
    • Location: Andover UK
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/11/26 01:35:04 (permalink)
    0
    Mention of cache....
     
    is it safe to delete C:\Users\wortinguk\AppData\Local\mplab_ide\Cache\dev\v5.20\var and all sub folders?
     
     
    Edit: done it... NetBeans reloads.  Still have the issue  :(
     
    post edited by wortinguk - 2019/11/26 05:23:56
    #13
    crosland
    Super Member
    • Total Posts : 2049
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2019/11/26 02:31:09 (permalink)
    +2 (2)
    ric
    It's just the crappy third party IDE that gets confused.

    I've had the same problem with Eclipse for a different processor family.
    It's Microchips crappy implementation of Netbeans that is the problem.
     

    Things got worse in XC8 v2 where the include folders all moved down one level to allow for "AVR" and "PIC" variants.
    Microchip really seem clueless about how to fix this.

    See above :)
    #14
    G0RSQ
    Starting Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2010/12/05 11:20:58
    • Location: 0
    • Status: offline
    Re: MPLAB x IDE: Cannot find xc.h 2020/09/18 15:58:14 (permalink)
    +1 (1)
    I have just spent a day with an identical issue.
    No autocomplete
    Spellchecker giving errors for everything
    Warnings for every command, such as TRISA, ADCON0 etc
    Issue was the include folder was not being pointed to in the project settings.
     
    Right click PROJECT
    then PROPERTIES
    XC8 TOOLCHAIN
    XC8 COMPILER
    and navigate INCLUDE DIRECTORY to your include files.
    in my case ..\..\..\..\Program Files (x86)\Microchip\xc8\v2.30\pic\include\proc
     
    As soon as i did this the sorcecode file cleaned its self up, with no spellcheck errors, no warnings/errors over the line numbers, and code taking on correct format, and autocomplete working.
     
    Frustrating finding it, but worked for me.
     
    Not sure i need to do this for every project (just learning to code in C after years of ASM) or if it will stick globaly.
     
    Hope it helps someone!
    #15
    Jump to:
    © 2020 APG vNext Commercial Version 4.5