Go to Post My grades were horrid when I started, but thanks to the mentors and other students, I'm now a straight-A student. - Bax2996 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-01-2007, 21:57
dpick1055's Avatar
dpick1055 dpick1055 is offline
David Pick
FRC #1739 (Chicago Knights)
Team Role: Alumni
 
Join Date: May 2005
Rookie Year: 2004
Location: Chicago
Posts: 75
dpick1055 is on a distinguished road
Send a message via AIM to dpick1055
MPLAB syntax problem

I've now written some drive code for our robot and I wanted to compile it to make sure it worked. I didn't have the cd that came in the kop so I downloaded the student trial of the C18 complier and installed it. When I tried to compile my code I got this error.

Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\camera.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\camera_menu.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\eeprom.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\ifi_startup.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\ifi_utilities.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\main.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\serial_ports.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\terminal.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\tracking.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\tracking_menu.o" is up to date.
Make: The target "C:\Documents and Settings\David Pick\Robotics\frc_camera_21\user_routines.o" is out of date.
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 "user_routines.c" -fo="user_routines.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066 -D_FRC_BOARD
MPLAB C18 v3.02 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 59
C:\Documents and Settings\David Pick\Robotics\frc_camera_21\user_routines.c:367:Er ror: syntax error
Halting build on first failure as requested.
BUILD FAILED: Mon Jan 22 20:53:36 2007

Except the only code on line 367 is:

char target;

Which also happens to be the first line of code I wrote.
Anybody know whats going on? Thanks.
__________________
Always remember to take your powered wheels off the ground when first testing code. Otherwise you'll end up with holes in the wall like us
  #2   Spotlight this post!  
Unread 22-01-2007, 22:29
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,586
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: MPLAB syntax problem

You'll have to post more code before and after that, preferably the entire function.

One possibility is that you are declaring variables in the middle of the function, which is legal in C++ but not in C.

Also, The C18 compiler version 3.x won't work with the existing libraries. You must use the version 2.4 that came in the kit. That probably isn't causing the syntax error, but will keep you from successfully compiling farther down the road.
  #3   Spotlight this post!  
Unread 22-01-2007, 22:39
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
Re: MPLAB syntax problem

It's a bad term for the error, but MPLAB will call any variable declaration, not at the beginning of the routine, a syntax error. If that's not it, check all your preprocessor directives. There may be something put in by the preprocessor that's causing the error, or perhaps the term target is #defined as something already.
__________________
Code:
void function(void)
 {
  function();
 }
  #4   Spotlight this post!  
Unread 23-01-2007, 00:14
dpick1055's Avatar
dpick1055 dpick1055 is offline
David Pick
FRC #1739 (Chicago Knights)
Team Role: Alumni
 
Join Date: May 2005
Rookie Year: 2004
Location: Chicago
Posts: 75
dpick1055 is on a distinguished road
Send a message via AIM to dpick1055
Re: MPLAB syntax problem

Moving the variable declarations got rid of the errors. Thanks for the tip. The only problem is now I get a different error.

MPLINK 4.02, Linker
Copyright (c) 2006 Microchip Technology Inc.
Error - Coff file format for 'ifi_library.o' is out of date.
Error - Could not build member 'ifi_library.o' in library file 'C:\Documents and Settings\David Pick\Robotics\frc_camera_21\FRC_alltimers_8722.lib '.
Errors : 2

BUILD FAILED: Mon Jan 22 23:12:57 2007

I think I remember seeing another thread about an error like this so I'm gonna search for it. Thanks for your help.

[edit]Found the problem in another thread, thanks for your help [/edit]
__________________
Always remember to take your powered wheels off the ground when first testing code. Otherwise you'll end up with holes in the wall like us

Last edited by dpick1055 : 23-01-2007 at 00:18.
  #5   Spotlight this post!  
Unread 23-01-2007, 12:16
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: MPLAB syntax problem

You need to use the C suite from the KOPs. There are incompatibilities between the suite provided in the KOP which is an older version of compiler/linker and the current versions from Microchip's website.
  #6   Spotlight this post!  
Unread 23-01-2007, 12:25
shtylman shtylman is offline
some sort of programmer
FRC #2420
 
Join Date: Feb 2004
Rookie Year: 2003
Location: Marietta, GA
Posts: 37
shtylman has a spectacular aura aboutshtylman has a spectacular aura about
Re: MPLAB syntax problem

Quote:
Originally Posted by Jake M View Post
It's a bad term for the error, but MPLAB will call any variable declaration, not at the beginning of the routine, a syntax error. If that's not it, check all your preprocessor directives. There may be something put in by the preprocessor that's causing the error, or perhaps the term target is #defined as something already.
As he said, what is probably going on is that you are declaring a new variable after some code. In C90 (I think this is what mcc18 uses) new variable declarations must go at the start of a block (right after the '{'). Try that and see if it helps.
  #7   Spotlight this post!  
Unread 23-01-2007, 13:28
dpick1055's Avatar
dpick1055 dpick1055 is offline
David Pick
FRC #1739 (Chicago Knights)
Team Role: Alumni
 
Join Date: May 2005
Rookie Year: 2004
Location: Chicago
Posts: 75
dpick1055 is on a distinguished road
Send a message via AIM to dpick1055
Re: MPLAB syntax problem

Thanks, that got rid of the error.
__________________
Always remember to take your powered wheels off the ground when first testing code. Otherwise you'll end up with holes in the wall like us
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with MPLAB dpick1055 Programming 5 21-01-2007 00:34
MPLAB C18 problem Justyn Programming 0 09-03-2005 11:37
MPLAB IDE Problem amateurrobotguy Programming 10 26-02-2005 09:29
Problem with MPLAB d.courtney Programming 5 02-02-2005 21:42


All times are GMT -5. The time now is 19:15.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi