• AVR Freaks

Hot!Unresolved directive #include <xc.h>

Page: 12 > Showing page 1 of 2
Author
didierleplae
Junior Member
  • Total Posts : 101
  • Reward points : 0
  • Joined: 2019/03/31 16:57:50
  • Location: 0
  • Status: offline
2019/11/26 16:18:39 (permalink)
0

Unresolved directive #include <xc.h>

I was working on an mplab project one computer and moved it to another. It seemed to work for a bit but after some small changes it is no longer working correctly and have tried everything I can think of.
 
I noticed that many of the includes have a red underline
 
For example all of the #include <xc.h> I get an unresolved directive message if I control+hover over it.
 
How can I fix this?
#1

26 Replies Related Threads

    katela
    Super Member
    • Total Posts : 1468
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/26 16:31:30 (permalink)
    0 (2)
    If your code compiles with no errors, then don't worry about those red lines, it's the IDE issue.
    If you can't compile your code, then post the error message.

    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
    #2
    didierleplae
    Junior Member
    • Total Posts : 101
    • Reward points : 0
    • Joined: 2019/03/31 16:57:50
    • Location: 0
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/26 16:33:28 (permalink)
    0
    katela
    If your code compiles with no errors, then don't worry about those red lines, it's the IDE issue.
    If you can't compile your code, then post the error message.



    It compiles without errors but my LCD is no longer working with projects that it worked with before. 
    I thought it may have been due to that issue, but I guess it is probably unrelated.
     
    #3
    katela
    Super Member
    • Total Posts : 1468
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/26 16:49:15 (permalink)
    +1 (1)
    Are all the software versions the same in both computers? like the compiler version?
    If you need help with the lcd, provide more details of what's not working, how you are testing, the code, etc.

    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
    #4
    ric
    Super Member
    • Total Posts : 24638
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/26 17:34:43 (permalink)
    +1 (1)
    The OP already has a topic about the LCD issue at https://www.microchip.com/forums/m1119228.aspx
     

    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!
    #5
    AMPS
    Super Member
    • Total Posts : 468
    • Reward points : 0
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/26 22:42:26 (permalink)
    -1 (1)
    Can you post your complete code and wiring diagram.
    Let me know Controller details/IDE version/Compiler version.
     

    Amps
    *.*.*.*.*.*.*.*.*.*.*.*.*
    #6
    ric
    Super Member
    • Total Posts : 24638
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/26 22:47:51 (permalink)
    +1 (1)
    ajitnayak87
    Can you post your complete code and wiring diagram.
    Let me know Controller details/IDE version/Compiler version.

    Can't you read?
    This OP already has a topic about their LCD problem, as the post immediately before yours states.
    Please do NOT encourage them to start discussing that problem in a separate topic (i.e. here).
     

    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!
    #7
    didierleplae
    Junior Member
    • Total Posts : 101
    • Reward points : 0
    • Joined: 2019/03/31 16:57:50
    • Location: 0
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/27 00:18:26 (permalink)
    0
    I figured out my problem. I was just making a dumb mistake and noticed the red underlines and thought it might be the problem.
    #8
    wortinguk
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2019/06/12 05:41:15
    • Location: Andover UK
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/27 03:14:23 (permalink)
    -2 (2)
    katela
    If your code compiles with no errors, then don't worry about those red lines, it's the IDE issue.
    If you can't compile your code, then post the error message.

    That is such a crappy response.
     
    An IDE is supposed to make a programmer more productive. This IDE does not do that.
    - The lack of auto complete makes me way less productive.
    - So much red on the screen means I cant see my code errors, through all the IDE errors, due to lack of xc.h.
     ... In my picSetup() code, every line is red!

    Its a MICROCHIP problem. WHEN WILL MICROCHIP FIX THIS?
     
    XC8 v2.05 for PIC12F1501

    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

    Best Regards, Dave    (Andover. UK) 
    #9
    ric
    Super Member
    • Total Posts : 24638
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/27 03:24:25 (permalink)
    +3 (3)
    wortinguk
    Its a MICROCHIP problem. WHEN WILL MICROCHIP FIX THIS?

    Ask Microchip.
    http://support.microchip.com
    We're just users, same as you, telling you how we cope with Microchip's crappy software.
     

    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!
    #10
    oliverb
    Super Member
    • Total Posts : 245
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/27 08:30:49 (permalink)
    0
    Can you try MPLAB 5.10? I've delayed updating so I can't comment on 5.20 but 5.10 seems to be working out well.
     
    #11
    1and0
    Access is Denied
    • Total Posts : 10005
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/27 11:08:21 (permalink)
    +1 (1)
    oliverb
    Can you try MPLAB 5.10? I've delayed updating so I can't comment on 5.20 but 5.10 seems to be working out well.

    The latest MPLAB X is v5.30.
    #12
    didierleplae
    Junior Member
    • Total Posts : 101
    • Reward points : 0
    • Joined: 2019/03/31 16:57:50
    • Location: 0
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/27 13:04:16 (permalink)
    0
    How do people feel about MPLAB XPRESS? There would be no need to upgrade then and could minimize problems like I had switching between computers?
    #13
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3370
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: online
    Re: Unresolved directive #include <xc.h> 2019/11/27 15:06:52 (permalink)
    0
    MPLab X has got better though, there are still some weird stuff going on with the color scheme and the auto comment icon.
     
    Like this:
    couti #txtref, terminator
     
    if I highlight that and click on the comment icon.
    instead of:
    ;couti #txtref, terminator
    I get this instead:
    # couti #txtref, terminator
    (Hash then space)
     
    If I close then reopen the file the bug goes away, color sceme restored.
    (Directives appear in the wrong color, I like a purple end. (No innuendos)
     
    Auto complete, who does that ?
    Selector for structures, yes.
     
    It's a matter of configuring it over time.  Reg squiggly lines everywhere.
     
    Select from Menu -> Tools -> Options
    Then select Editor -> Spellchecker
     
    Top pane: Languages can be de-selected.
    Bottom pane: Contains spell checkers, remove them all.
     
    The spell checker plugin can also be removed.

    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.
    #14
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3370
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: online
    Re: Unresolved directive #include <xc.h> 2019/11/27 15:17:47 (permalink)
    0
    When creating C header files, append comments.
     
    extern int
        add(int A, int B);    // return the addition of two numbers
     
    This becomes the manuscript window.
    // return the addition of two numbers
    add(
     
    You could go through all the c header files and add comments then you will not see "Man not found" anymore.
     
     
     
     

    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.
    #15
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3370
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: online
    Re: Unresolved directive #include <xc.h> 2019/11/27 15:42:42 (permalink)
    0
    One more color fix is the error color, Microchip libraries become highlighted due to some ref error even though there are no errors.
     
    Select Options -> Fonts and Colors -> Syntax
     
    Select C language then select, "error" from the category list.
     
    Colors: set background and foreground to, "Inherited"
     
    You now have a color free MPLabx.
     

    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.
    #16
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3370
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: online
    Re: Unresolved directive #include <xc.h> 2019/11/27 15:45:11 (permalink)
    0
    Post #14 to remove squiggly lines.
    Post #16 to remove highlighted errors.
     

    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.
    #17
    vleroylr
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2018/08/09 20:12:20
    • Location: 0
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/11/28 09:19:44 (permalink)
    0
    What I do to fix the problem is to right click on the project on the Projects tab, Then Properties -> XC8 Global Options and then click on Reset.
    At least it solves the problem TEMPORALY, as I have to do it everytime I enter the IDE again. It really needs to be fixed.
    #18
    didierleplae
    Junior Member
    • Total Posts : 101
    • Reward points : 0
    • Joined: 2019/03/31 16:57:50
    • Location: 0
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/12/02 13:42:25 (permalink)
    0
    vleroylr
    What I do to fix the problem is to right click on the project on the Projects tab, Then Properties -> XC8 Global Options and then click on Reset.
    At least it solves the problem TEMPORALY, as I have to do it everytime I enter the IDE again. It really needs to be fixed.





    This trick partially worked for me just now. I moved a project again from my home computer to my studio. There were red lines all over the place. Resetting the XC8 Global Options fixed most of them. 
    However, all my "bool" variables are still underlined. 
     
    Also, eeprom_read and eeprom_write are underlined, but those don't seem to be a problem.
    #19
    ric
    Super Member
    • Total Posts : 24638
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Unresolved directive #include <xc.h> 2019/12/02 14:13:23 (permalink)
    0
    didierleplae
    However, all my "bool" variables are still underlined.

    "bool" is not a standard C type. What library are you including to get them?
     

    Also, eeprom_read and eeprom_write are underlined, but those don't seem to be a problem.

    They are functions from the old plib that hasn't come with XC8 since v1.34.
    Which version of XC8 are you using, and have you done something to get them?

    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!
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5