Problem compiling a C program

Discussion in 'Programmer's Corner' started by fugro, Dec 16, 2010.

  1. fugro

    Thread Starter New Member

    Jul 21, 2009
    I found a project for a data logger on the web, which looked very useful. It is built around a 16F876 pic and, not being a programmer myself, i am baffled by the problem of compiling the C program that came with the project. The hardware side is no problem and is completed.
    After browsing Allaboutcircuits, I concluded that MPLB IDE was the best compiler to try, but my attempts to compile the program failed The error was on the first header file < 16f876 h > which could not be found.
    I consulted my daughter, who teaches programming, and she suggested that it might be possible to configure MPLAB to point to the correct folder/s, but I'm afraid that is beyond me.
    I would be extremely grateful if anyone could solve my problem, either by providing a set of intructions on how to set up MPLAB , or by taking a look at the program (pdf attached) and pointing out or correcting any obvious errors.
    I know it is a lot to ask, but I really would like to see this project working.
  2. cheezewizz

    Active Member

    Apr 16, 2009
    Correct me if i'm wrong but when you initially install MPLAB it's only an assembler (ie useful for assembling and linking .asm files) unless you install one of the trial versions of the c compilers that come with it. Looking at the code itself, I'm guessing that it was written to be compiled using the CCS compiler, so grabbing a copy of that (trial or lite version is free iirc) would be your best bet. having said that, the code also uses a header that won't come packaged with the compiler (jonsinc.h) so I'm assuming someone called jon has put together there own header file, if you can't work out what's in there or get a copy of it then it still won't compile.
  3. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    Find out if the program was built/compiled using CCS, Hi-Tech C, Sourceboost C, MikroC, etc. There are MANY C compilers around for PICs, and not all of them have the exact same libraries or definitions.

    You'll probably get that information when you find the other missing header file.
  4. fugro

    Thread Starter New Member

    Jul 21, 2009
    Cheezwizz, ThatOneGuy,

    Thanks for your advice, it gives me a much better idea as to what's going on.

    I'll investigate as you suggest.