Hi, I’m a new programmer when it comes to FRC (I programed for FVC last year, and have some level of programming background), and I’m having trouble getting some code to compile.
The assembler works fine, but when MPLINK starts up, it fails, giving an error message of:
Error - could not find definition of symbol 'STATUS' in file 'J:\*\user_routines_fast.o
Strange thing is, I haven’t modified user_routines_fast.c at all, just user_routines.c and user_routines.h. I’ve tried replacing basically every other file with clean copies from the default code, and I’ve compiled the default code itself to make sure that the linker isn’t screwed up. Any help?
What does project->build options->project show under the General tab for include path? It should point to mcc18\h subdirectory where the pic*.h files are located. That is where STATUS is defined.
What does edit->find in files with find what equal to STATUS show.
Note ifi_routines_fast.c includes user_routines.h so a change there may have effected the build. The file ifi_default.h should include p18cxxx.h which will include the correct header file for the processor (p18f8722.h) if the project configuration is set correctly. The ‘STATUS’ name is defined in the p18*.h file.
The include path was wrong, and I fixed it, but the error is still occuring. Plus, I can’t find STATUS anywhere, just some references to statusflag and Device Status.
I also don’t recognize some of the files you’re talking about. In my program directory I have:
the library file (722 one), and the linker file (same). Am I missing something?
EDIT: I downloaded Keven’s code and got the same thing in ifi_code.o. If it makes a difference, I’m running MPLAB 8.0 and C18 3.10
There might be some residual file references left in the project definition from when the directory paths were messed up. Try doing a full Build of the project instead of a Make (or just do a Clean first).
dcbrown is correct to point out that editing user_routines.h will affect user_routines_fast.c (because it’s #included). What changes did you make? It’s possible that something at the very end of the .h file is causing the compiler to misinterpret something at the beginning of the .c file.
Doing a Build All doesn’t change anything; the error still appears.
All I added was the following after the #defines for OPEN and CLOSE. They’re all used in user_routines.c:
#define PI 3.14159265 // Defines pi for use in converting radians to degrees & vice versa
#define LENGTH 34 // Defines the distace between wheels along the length of the robot in inches
#define WIDTH 21 // Defines the distace between wheels along the width of the robot in inches
#define MAX_DEFLECTION 0.78539814 // Defines the maximum angle at which the robot will turn (measured at the near wheel to the turn) in radians
#define MAX_DIFFERENTIAL 64 //Defines the maximum value by which motors will slow for differential turning. Uses 8-bit value (ie. 55 means that a value of 255 will become 200, 0 will become 55)
#define PWM_NEUTRAL 2 //Defines the range at which a pwm value is considered neutral (127). (note: value of 6 will result in range of 121-133)
#define potentiometer_left rc_ana_in01 //potentiometer on right motor
#define potentiometer_right rc_ana_in02 //potentiometer on left motor
So far as I can see, I didn’t add anything else accidentally.
Also, note the edit in my last post.
It definitely makes a difference! The IFI-provided code is compatible with C18 version 2.4, which is the version on the CD-ROM in the Kit of Parts. It is not compatible with any later version of the compiler.
Sorry, I should have been clearer. That’s only the machine I’m on right now. I get the same thing on another machine I have running whatever C18 was on the CD. Both are running MPLAB 8.0, though.
Without the full project, we’re making guesses based upon previous experience.
One way of trying to fix this is to add the following line to user_routines_fast.c before any other #include directives.
Check Configure->Select Device, make sure device in dialog box is
Report any errors. Are there no warnings or messages in the output before this? What is the specific error line, “'J:*” should be “J:<dir1>…” MPLAB is path length sensitive…, what is the exact error message output.
I added the defines to my project and it compiled/linked ok so it is something else either within the source files or within the build environment.
Okay, I uninstalled and reinstalled everything and copied my code over into a new project, and now things are working. Seems like I probably screwed something up while playing around with settings, possibly twice. Thanks anyway.