Errors compiling Kevin's new code (pragmas)

hey guys, trying to compile kevin’s code (made changes to default_routines only), getting some errors in MPLAB.

258: warning [2002] Unknown pragma ‘tmpdata’
249: Error [1020] Unexpected input folowing ‘interrupt’
364: warning [2002] Unknown pragma ‘tmpdata’

Can anyone help?

Also, what exactly is a pragma? I’ve never dealt with them before, so help is greatly appreciated.

PS- If I comment off the three lines that cause errors, it gives me

442: Error [1111] undefined label ‘_FPFLAGS’ in ‘_startup’

Are you compiling his code for the 3.x compiler with the 2.4 compiler?

That’s probably it. I thought we had updated it, but apparently not. I’ll post back here if that doesn’t fix it.

Okay, that fixed the original issues.

Now however, when it gets to the last linking step (COFF to HEX), it pops up “failed to load file xxxxx.cof.”

The COFF file is right there in the folder, and it can find it when it is cleaning up the files when I try to build it again. Any ideas?

Update- After done building, the output screen occasionally returns “Error: bad magic number in Coff file xx/xx/autonomous.o”

On the project check the build options to make sure they are the right paths.

Clean sometimes will get something via a different path that the linker won’t see.

Which paths?

The linker and lib paths are the defaults (C:\mcc18[lib or lkr]). I tried to manually set the output directory to the correct directory, but it changed nothing.

If the “magic number” is different across the project it means somewhere you’ve got a piece of code compiled with the wrong compiler version and the linker gets unhappy. My guess is that you’re trying to link everything together with the 3.1 tools, but have the wrong version (i.e., 2.4) of the ifi_frc.lib file.


I downloaded the simple C18 3.0 code from your site, so I assume the ifi_frc file is up to date.

If it helps at all, if I download the hex file that appears (but is definitely not complete) to the bot, all the OI’s pwm, realy, and switch lights turn on.

Finally, printf almost always returns one of a few errors, no matter what I’m printing. Any suggestions as to why? Not entirely sure of specific errors, I’ll edit if I come across one again.

Sorry, missed the editing window.

Anyways, where can I find the update ifi_frc.lib file? I have ifi_frc_8722.lib and ifi_frc_8520.lib, but no ifi_frc.lib, ifi_frc.lib.

I checked kevin’s page, and the ifi robotics page, but couldn’t find it.


The numbers in the file correspond to a specific version of the robot controller. The current controller version as of 2006 is 8722, which is the one you want.

In the Library Files area of your project you want the downloaded ifi_frc_8722.lib compiled with C18 3.0+. Also, make sure that your linker script is the 18f8722.lkr.

Hope that helps.

Yes, we are using the 8722 lib and lkr files.

I’m having the same problem with the new default 2008 code. Everything compiles fine, but I keep getting the error that it “Failed to load project.cof”. I’ve made sure that the library and linker include paths were right, and using the correct linker/library versions.