Compilation Errors

I get compilation errors. How do I know where my mistake is?

Often you can double-click on an error message in the Output window and it will show you the line of code or area where it is having trouble compiling.

It won’t compile, but I am 100% certain that my code is good!

**An example of when this symptom might occur is when you remove a file from your project and replace it with another file. Then you might see an error like this:
Error - symbol ‘Limit_Switch_Max’ has multiple definitions.

Sometimes the following steps will help:

From the Project menu, select Clean. This removes old intermediate files and ensures that new ones are built when you compile.
From the Project menu, select Build All. This ensures that all files are compiled fresh, and no old ones are used.**

I fixed my bugs, but the code still acts as if I hadn’t fixed it!

**Sometimes when you compile it may be using old intermediate files instead of freshly compiling your new and improved source. Sometimes the following steps will help:

From the Project menu, select Clean. This removes old intermediate files and ensures that new ones are built when you compile.
From the Project menu, select Build All. This ensures that all files are compiled fresh, and no old ones are used.**

I’m using a supported OS, but my code won’t compile!

**
There may be several reasons for this:

A) You may not be using the compiler in the same login account under which MPLAB and the C18 compiler were installed. If you login as another user, the C18 compiler may not be linked to your MPLAB.

B) You may not have properly followed the instructions from our web site for installing C-BOT. If you tried to wing it you probably missed some important installation options and your C18 compiler may not have been linked to MPLAB. If you suspect this is your problem, uninstall MPLAB and C18 from the Windows Control Panel and then re-install by following the instructions in “Microchip C-Bot Installation Guide”, available from our web site.**

It won’t compile and says it’s missing adc.h!

**You probably didn’t follow the installation instructions from our website!

You should be able to fix it easily enough, however.

In MPLAB, from the menu select:
“Project->Build Options…->Project”

In the “General” tab, be sure to set the following in the 4th and 5th lines:
c:\mcc18\h for Include Path
c:\mcc18\lib for Library Path

Click “OK” and now you should be able to compile.

If this doesn’t fix your problem, you should uninstall MPLAB, and then reinstall it by following our Microchip C-Bot Installation Guide.
**

Compilation error “name exceeds file format maximum of 62.

**The Microchip compiler has a 64 character limit for path/file names. Try to shorten your folder and file names, or move the files closer to the root directory. Example: C:\FrcCode\

Update: The character limitation only appears to affect the coff to cod conversion. Under Project, Build Options, Project then under the MPLINK Linker tab, you can select “Suppress COD-file generation" to disable the creation of the cod file.
**

How come I can load the project for the default code and build it without errors and then when I build it again I get errors?
Also if I open My Computer and delete all the new files(.COD & .O for instance) in the folder with the rest of the project, then I can start MPLAB IDE and build the project again one time.

After advising the customer to do a complete un-install and re-install, he wrote back: Saturday we uninstalled all the SW and then reinstalled everything. Seems to work now. I can Build All and the do it again with no problems. We have the latest MPLAB IDE v6.62 and the latest version of the compiler and the Default release for the camera.

We download the complier and after modifying some of the user code to map joysticks to pwm’s we keep getting this error message.
C:\Robotics\programming\FrcCode2005v2.4\user_SerialDrv.c:30: unable to locate ‘stdio.h’ error 1 spawning c:\mcc18\bin\cpp18. Halting build on first failure as requested. It can’t find the stdio.h so what are we doing wrong?

**Just delete all your default code/files and get the latest Default Code v2.4 from our web site.
**

We have been trying to get the code onto our RC for a bit now. Often we get the code on (after compiling fine) the program light turns red (Code Error). We have been unable to find this error. This is only when it gets on the controller properly. It sometimes also freezes the Innovation First loader. Originally we were getting a similar error message as http://www.ifirobotics.com/forum/viewtopic.php?t=171 this but that has since gone.

The customer was getting an Error Window called Progmem.mcp when downloading. This window displays hex location that would not verify After working with the customer, if was found that the RC unit had a problem with the flash memory. The unit will be return to us under warranty.

We have downloaded the default RCver2.4 code. However, we keep getting the error: C:\Robotics\programming\FrcCode2005v2.4\user_SerialDrv.c:30: unable to locate ‘stdio.h’ error 1 spawning c:\mcc18\bin\cpp18. Halting build on first failure as requested. Despite the fact we have relocated a copy of ‘stdio.h’ to the folder that user_SerialDrv.c is in, we can not get rid of this code. Help!!!

If you have the Default Code v2.4 from our web site and you still get the “stdio.h” error, be sure you are using the Microchip C18 v2.4 compiler. You must use this new C18 Compiler with the Default Code v2.4. Their web site: ftp://devtools:mpseven@ftp.microchip.com/Languages/MPLABC18/. Do a complete un-install before loading the new software.

I’ve got the new code to compile past the point of: cannot find stdio.h, but it seems to find an error: could not find definition of symbol ‘printf’ in file ‘F:\Robot\RCdefault2.5\FrcCode2005v2.4\user_routines.o’. When I looked in the folder this file was supposedly in, I couldn’t even find the file! How do I get past this problem?

Most likely there are some files left from the previous Compiler that the new Compiler does not recognize. Inside of MPLAB, you want to do a “Clean" located under the Project pull down tab. This should delete old files. This is a good thing to do anytime you have problems. Now do a “Build All" located under the Project pull down tab. You should now be ready to download the new FrcCode.hex file.

I tried to install the update v.2.4,-- because I think v.2.0 cdrom is missing some header files-- then I get the following error message:
No previous installation!
The specified installation directory is not an upgradable previous installatin of MPLAB C18. Please contact microchip for info on purchasing.
I had v 2.0 cbot was previously installed [cdrom version] although I don’t see it under: Start ->Programs [Shouldn’t I be seeing it here iff installation was successful?]

After advising the customer to do a complete un-install and re-install, (using the correct C18 compiler from the FIRST Link) he wrote back he was fixed.

When compiling, the above error occurs. However, when I comment out just a small bit of code… the problem goes away. When I check my memory map with the succesful build I am only using 85% of the memory. Why does this section error occur if it’s not too much code for storage?

You do have too much code that can be stored in the uP. You must reduce the size of your code. Be sure to remove your printf statements, they use big libraries. Math function, like floating point numbers, will increase your code size. If you can not reduce your code to fit, we may be able to install a different uP with 4 times the code space of the current RC unit. Please call for availability.

When we put in 22 or more commands into command.h, we get the following error: Error -section ‘.idata_robot.o’ can not fit the section. Section ‘.idata_robot.o’ length=0x00000108. Can anyone help me with this?

You have too much code that can be stored in the uP. You must reduce the size of your code. Be sure to remove your printf statements, they use big libraries. Math function, like floating point numbers, will increase your code size. If you can not reduce your code to fit, we may be able to install a different uP with 4 times the code space of the current RC unit. Please call for availability.

I had downloaded the WRRF Code (04092004) from the WRRF Website.

With the default framework, I inserted a few lines of code.

 RLight = RC_ANLG_IN(3);
   LLight = RC_ANLG_IN(1);
   
   if (LLight > 70) {
      printf("LLight MORE 70\n");
   } else {
      printf("LLight LESS 70\n");
   }
   
   if (RLight > 70) {
      printf("RLight MORE 70\n");
   } else {
      printf("RLight LESS 70\n");
   } 

RLight and LLight had been defined as integers.
We compiled the code, but upon using IFI Loader to download the .HEX file to the IFImini, the PROGRAM STATE on the IFImini blinked orange, and I received this error log in ERROR.MCP:

003A00 F5 D7 12 00 FF 0E E3 50 35 6E 48 0E 01 D0 4C 0E
003A10 E7 6E E7 2E FE D7 E7 6A E7 2E FE D7 35 2E F7 D7
003A20 00 00 12 00 FF 0E E3 50 E8 4E 12 00 00 00 00 D0
003A30 00 D0 00 D0 E8 2E FA D7 12 00 C2 90 9D 9C 12 00
003A40 C2 82 12 00 00 00 00 00 06 31 FF FF FF FF FF FF 

The idea was just to receive input from 2 VEX Line Tracking Sensors, and process the information. However, after umpteen times of attempts, we could not come up wih any solution.

It appears your micro-processor chip has a bad section of memory. Please call 903-453-0802 for an RMA # so that you can send the unit in for repair.