1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

C18 - unable to locate 'p18cxxx.h'

Discussion in 'Microcontrollers' started by futz, Apr 23, 2008.

  1. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    Decided to try out C18 tonight and I've run into a little problem. I get
    Code (text):
    Error [1027] unable to locate 'p18cxxx.h'
    every time I try to compile.

    I googled for it a bit and everyone says the same thing, "Just point your include search path to c:\mcc18\h. Well, I'd already done that and it gives the error anyway. Yes, it is the correct path to the h directory.

    EDIT: Got it. Apparently you can't change it from Project/Set Language Tool Locations. You have to use Project/Build Options instead. Weird!
     
    Last edited: Apr 23, 2008
  2. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    I hit the limit for the demo so I bought a BoostC Full license today. Then instead of continuing with my coding, I installed C18 and started testing it out. So far I like BoostC better, but it will take a lot more use before I really know for sure. Anyway, I can afford BoostC and I cannot afford C18, so that settles that. :p
     
  3. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,541
    Likes:
    174
    Location:
    Toronto, Canada
    Aside from the optimizations being turned off for the SE version what was wrong with C18?
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    Nothin wrong with it. But if I had to choose between a $500 18F-only compiler and a $75 compiler that works just as well, and includes a 16F and an 18F compiler... It's a no brainer. :p I bought BoostC. That isn't going to stop me from getting comfy with C18 as well.

    I don't like C18's delays.h lib at all, but there's nothing stopping me from writing my own that's easy to use like BoostC's. C18's is probably better for some things. It's likely much more accurate.

    BoostC's way of accessing bits is much simpler and takes much less typing than C18's way. There may be shortcuts that I don't yet know about, though. Could probably build some macros that fix it.
     
    Last edited: Apr 23, 2008
  6. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,417
    Likes:
    231
    Location:
    OKLAHOMA USA
    People should use whatever compiler they are comfortable with (use and pocket). I have not used BoostC but am impressed by the low cost of the non-professional offering.

    BoostC does not support unions which forces them to use another method to describe register bits. The nice thing about unions is that they allow you multiple descriptions/names for the same set of bits.

    In C18 you see TRISAbits.TRISA0 which is awkward. If you do not like that you can amend the .h file so you could write TRISAbits.b0. The C18 method makes more sense when you use registers where bits or groups of bits have names related to function. It does a lot to make setup code readable.

    Including 'p18cxxx.h' picks the .h file based on what processor you are using. Some people feel it is better to specify the processor directly to prevent the compilation of the project for the wrong processor. Try including the specific processor header file, p18F2550.h or such.
     
  7. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,720
    Likes:
    422
    Location:
    Brisbane Australia
    This is really important when people post code on here. If they use 'p18xxx.h' then we have no idea which processor they are using and can't advise that the pins may be analogue or they didn't turn off comparators etc.

    I also shy away from typing shortcuts as they invariably lead to bugs. I find 2 seconds typing a longer variable name now saves me 3 hours(+) trying to debug it 3 months later.

    [tangent] Does the free C18 compiler without optimisation produce bigger code than BoostC with it?[/tangent]

    Mike.
     
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  9. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,541
    Likes:
    174
    Location:
    Toronto, Canada
    Well since I'm at the C learning stage I can't realistically make a informed opinion on C18, vs boost C, microC, Hitech C, CCS C etc.
    That said I have to pick one (feels like choosing your religion)
    I'm sticking with C18 for the moment as
    1. I've got it
    2. the free SE edition has no limits aside from optimization disable
    3. official Microchip 18F compiler
    4. Microchips 18F libraries are for C18 eg the TCP/IP stack
    PS I don't mind the "bits" part of C18.
     
  10. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,417
    Likes:
    231
    Location:
    OKLAHOMA USA
    Maybe Futz can look at that. The only other PIC compiler I use is the CCS PCM (midrange).
     
  11. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,417
    Likes:
    231
    Location:
    OKLAHOMA USA
    I think the bits part of C18 is actualy better then the variable.bitNum system.

    It allows the naming and grouping of bits by function.

    Thiis machine does not have a compiler installed so the names I am using may be wrong. Often timers use 3 bits to setup the prescaler. Lets say the control reg is TMR0CON and the prescaler bits are 3,4,and 5.
    Intstead of
    TMR0CON.3 =1;
    TMR0CON.4 =0;
    TMR0CON.5 =1;

    You could write the union such that you could use
    TMROCONbits.prescale = 0x5;
     
  12. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,720
    Likes:
    422
    Location:
    Brisbane Australia
    Yes, that would be nice. Unfortunately they didn't bother. I keep thinking of rewriting their .h files.

    Mike.
     
  13. BeeBop

    BeeBop Active Member

    Joined:
    Dec 22, 2005
    Messages:
    1,281
    Likes:
    23
    Location:
    Vancouver Canada
    Yes, you have not used it, and are not familiar with it, so why do you feel you must assert this?
    From the boost manual:
    and
    The compilers all have their quirks and quarks, and sometimes one will work for a particular app, much better than another will. I think, though, the price must figure into the equation if you plan to purchase.

    Boost was a great deal, as is CCS (especially if you go the PHAnderson route, and write your own libraries.) The only one which does not feel good to me is mikro - no MPLab integration, absolutely no access to their library source, ....
     
    Last edited: Apr 24, 2008
  14. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,417
    Likes:
    231
    Location:
    OKLAHOMA USA
    Because it says so on their web site!

    Futz's statement regarding "accessing bits" caught my attention. I was checking out the boostC website. On the products page I clicked on a link that compared their compiler with another. The comparison clearly showed that they did not support unions or structures!

    The comparisons on the boostC product page are based on their old C2C-plus compiler. The comparison links are clearly marked as C2C-plus and had I been paying attention I would have noticed. Should have noticed it was out of date.

    It was a honest mistake. I did not badmouth the product.
     
  15. BeeBop

    BeeBop Active Member

    Joined:
    Dec 22, 2005
    Messages:
    1,281
    Likes:
    23
    Location:
    Vancouver Canada

    Ah, I get it, and think those boys ought to update the website!
     
  16. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,417
    Likes:
    231
    Location:
    OKLAHOMA USA
    Yes but it was my mistake! Thanks for understanding.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice