Go to Post Baker, you're making my head hurt and it's only August!!!! - Rich Kressly [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 24-03-2004, 10:09
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Here's what I found in the users guide:
Quote:
1105: symbol ‘%s’ has not been defined
A symbol has been referenced before it has been defined. Common causes
include a misspelled symbol name, a missing header file that declares the
symbol, and a reference to a symbol valid only in an inner scope.
On the error line when you compile, is there something after the word 'symbol'? (i.e. did it not get pasted to CD right, or does it just not show up?)

I pasted your code into an editor and it looks like line 367 is "if (drive_timer > LOST_TARGET_TIMEOUT)", is that correct? If so, can you show us the section from the header file that defines "LOST_TARGET_TIMEOUT"?
  #2   Spotlight this post!  
Unread 24-03-2004, 10:14
CrashZero's Avatar
CrashZero CrashZero is offline
Computer Nerd
#1352 (Huskie Robotics)
Team Role: Programmer
 
Join Date: Mar 2004
Location: Stratford Northwestern
Posts: 44
CrashZero will become famous soon enoughCrashZero will become famous soon enough
Question Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

That was all there was in the compile box and I posted the whole .c file; is there a different file that you want to see???
__________________
This is our world now... the world of the electron and the switch, the beauty of the baud. We make use of a service already existing without paying for what could be dirt-cheap if it wasn't run by profiteering gluttons, and you call us criminals. We explore... and you call us criminals. We seek after knowledge... and you call us criminals. We exist without skin color, without nationality, without religious bias... and you call us criminals. You build atomic bombs, you wage wars, you murder, cheat, and lie to us and try to make us believe it's for our own good, yet we're the criminals. Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for. I am a hacker, and this is my manifesto. You may stop me, but you can't stop us all...

quote from:

+++ The Mentor +++
  #3   Spotlight this post!  
Unread 24-03-2004, 10:45
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

Quote:
Originally Posted by CrashZero
That was all there was in the compile box and I posted the whole .c file; is there a different file that you want to see???
1- use the [code] tag.
2- Is this a file you wrote/modified?
3- Is there a Navigate.h? that might be what he is talking about.
4- Did you write this code?
  #4   Spotlight this post!  
Unread 24-03-2004, 10:48
EricS-Team180's Avatar
EricS-Team180 EricS-Team180 is offline
SPAM, the lunchmeat of superheroes!
AKA: Eric Schreffler
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Apr 2002
Rookie Year: 2001
Location: Stuart, Florida
Posts: 561
EricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

Hi,

He'd like you to post your Navigate.h header file, to look at how LOST_TARGET_TIMEOUT is defined...if that is where it is defined.

You could also do a search, through the folder that you have your code in, to see if it turns up anywhere. If not, then the you've found your error

Eric Schreffler
__________________

Don't PANIC!
S. P. A. M.
  #5   Spotlight this post!  
Unread 24-03-2004, 10:52
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

Or, in MPLAB, Project>Find in Project files... and type in "LOST_TARGET_TIMEOUT" (w/o quotes). in the Output window, see where it comes up.
  #6   Spotlight this post!  
Unread 24-03-2004, 10:54
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

Dave's right, the compiler is complaining about line 367:
Code:
if (drive_timer > LOST_TARGET_TIMEOUT)
But the compiler output appears to be truncated. It's supposed to tell you what name it doesn't recognize. There might be an invisible character in the source file on that line, which the compiler would choke on and be unable to display. The easiest thing to do at this point would be to duplicate the line, character by character, without doing a copy/paste, then delete the original line and try compiling again.

If that doesn't help, then show us the section of the header file where LOST_TARGET_TIMEOUT is defined (probably in navigate.h).

(Oh, and next time you need to post programs here, surround it with [CODE] and [/CODE] so the formatting is preserved.)
  #7   Spotlight this post!  
Unread 24-03-2004, 12:11
Biff Biff is offline
Registered User
AKA: Tom Cooper
#1227 (Techno Gremlins)
Team Role: Mentor
 
Join Date: Jan 2004
Location: Grand Rapids MI
Posts: 214
Biff is a jewel in the roughBiff is a jewel in the roughBiff is a jewel in the roughBiff is a jewel in the rough
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by Alan Anderson
Dave's right, the compiler is complaining about line 367:
Code:
if (drive_timer > LOST_TARGET_TIMEOUT)
But the compiler output appears to be truncated. It's supposed to tell you what name it doesn't recognize. There might be an invisible character in the source file on that line, which the compiler would choke on and be unable to display. The easiest thing to do at this point would be to duplicate the line, character by character, without doing a copy/paste, then delete the original line and try compiling again.

If that doesn't help, then show us the section of the header file where LOST_TARGET_TIMEOUT is defined (probably in navigate.h).

(Oh, and next time you need to post programs here, surround it with [CODE] and [/CODE] so the formatting is preserved.)
This C stuff is new to me, but the { }'s around line 367 I can't figure out if they all make sense, I think you may have some that are unmatched. Hope this helps
  #8   Spotlight this post!  
Unread 24-03-2004, 12:30
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by Biff
This C stuff is new to me, but the { }'s around line 367 I can't figure out if they all make sense, I think you may have some that are unmatched. Hope this helps
Oh, my. There's certainly something odd going on:
Code:
case DR_BOTH_CENTER:
{
    Navigator_State = AT_TARGET; // Both servos are within the target threshold
    printf("AT_TARGET\n");
    break;
}
}
}
    else
    {
        // We are not locked on - Stop
        // give the trackers a chance to catch up
        left_drive_set = LSTOP;
        right_drive_set = RSTOP;
        drive_timer++ ;
        if (drive_timer > LOST_TARGET_TIMEOUT) 
        {
            Navigator_State = TURN_TO_TARGET;
            printf("TURN_TO_TARGET\n"); // Done driving to center
            left_servo_set = 127;
            right_servo_set = 127;
        }
    }
    break;
}
There are three }s in a row right before a naked else statement. This source code is apparently missing a few lines, including an if.

There is also a case statement commented out near the top of the big switch. That can't be doing what you want, can it? If you want to "skip" that state, as the comments suggest, I think you need to initialize your state variable to DRIVE_TO_CENTER instead of WAIT_TO_DRIVE in line 37.
  #9   Spotlight this post!  
Unread 24-03-2004, 12:36
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by Alan Anderson
here are three }s in a row right
Looks weird, but I think they match up.
357 matches to 353 (case DR_BOTH_CENTER)
358 matches to 258(switch drive_state)
359 matches to 207(if Tracker_Data...)

I think that you're onto something with that commented case at line 131. That's definately not right

Last edited by Dave Scheck : 24-03-2004 at 12:40.
  #10   Spotlight this post!  
Unread 24-03-2004, 12:51
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by Alan Anderson
Oh, my. There's certainly something odd going on:
Code:
case DR_BOTH_CENTER:
{
    Navigator_State = AT_TARGET; // Both servos are within the target threshold
    printf("AT_TARGET\n");
    break;
}
}
}
    else
    {
        // We are not locked on - Stop
        // give the trackers a chance to catch up
        left_drive_set = LSTOP;
        right_drive_set = RSTOP;
        drive_timer++ ;
        if (drive_timer > LOST_TARGET_TIMEOUT) 
        {
            Navigator_State = TURN_TO_TARGET;
            printf("TURN_TO_TARGET\n"); // Done driving to center
            left_servo_set = 127;
            right_servo_set = 127;
        }
    }
    break;
}
There are three }s in a row right before a naked else statement. This source code is apparently missing a few lines, including an if.

There is also a case statement commented out near the top of the big switch. That can't be doing what you want, can it? If you want to "skip" that state, as the comments suggest, I think you need to initialize your state variable to DRIVE_TO_CENTER instead of WAIT_TO_DRIVE in line 37.
I believe the three braces are OK. If you move your cursor in turn to each of those braces and type Ctrl-M, the editor will take you to their matching opening braces. They look fine to me.

As to the commented out case label, THAT does look strange, but I highly doubt that would cause the compile error in question. I don't know what the compiler will do with a chunk of code inside a switch statement without a case label. My guess is that it will simply be unreachable.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #11   Spotlight this post!  
Unread 24-03-2004, 13:03
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,562
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: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by gwross
I believe the three braces are OK. If you move your cursor in turn to each of those braces and type Ctrl-M, the editor will take you to their matching opening braces. They look fine to me.

As to the commented out case label, THAT does look strange, but I highly doubt that would cause the compile error in question. I don't know what the compiler will do with a chunk of code inside a switch statement without a case label. My guess is that it will simply be unreachable.
When compiling with GCC, and an unmodified navigate.h, I only get one warning "warning: unreachable code at beginning of switch statement" So, the braces do all line up, and that commented out case caused a warning. It's possible that the problem is with that, and CrashZero should comment out that whole block. However, I would think that it's more likely that something was modified in navigate.h
  #12   Spotlight this post!  
Unread 24-03-2004, 13:21
Kevin Karan's Avatar
Kevin Karan Kevin Karan is offline
Linux Guy
AKA: maxdamage
None #0174 (Arctic Warriors)
Team Role: Alumni
 
Join Date: Jan 2003
Location: Liverpool, NY
Posts: 141
Kevin Karan will become famous soon enoughKevin Karan will become famous soon enough
Send a message via AIM to Kevin Karan
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

indent...indent...indent
__________________
It isnt ALWAYS the programmers falt!
2004: Buckeye team website award
2002: Rutgers semi-finalists
2001: National semi-finalists
2001: Rutgers semi-finalists
1998: Manchester Rookie All-Star Award
  #13   Spotlight this post!  
Unread 24-03-2004, 13:50
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by gwross
I believe the three braces are OK. If you move your cursor in turn to each of those braces and type Ctrl-M, the editor will take you to their matching opening braces. They look fine to me.
Okay, I see the if and the nested switch now. The lost formatting of the post made it darn near impossible for me to tell what the structure of the code was supposed to be. (By the way, Ctrl-M just adds a new line when I type it.)

If the trouble is with an unprintable character in the source code, the problem character probably wouldn't have survived being pasted here. But I believe that the definition of LOST_TARGET_TIMEOUT in navigate.h is a likely culprit and should be investigated.
  #14   Spotlight this post!  
Unread 24-03-2004, 15:51
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by Alan Anderson
(By the way, Ctrl-M just adds a new line when I type it.)
Are you using the MPLAB IDE? I don't think I did anything special to enable this functionality. It's also on the "Edit" menu: "Match".
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 24-03-2004 at 15:55.
  #15   Spotlight this post!  
Unread 24-03-2004, 16:55
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by gwross
Are you using the MPLAB IDE?
Um, no. I'm using Internet Explorer. I'm not anywhere near the computer we use to program the robot -- in fact, it's halfway to Chicago at the moment. I interpreted your mention of "the editor" as referring to viewing the HTML source of the page, where at least a little of the c file's formatting seems to be visible.
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
What is your most prefered programming language? Hailfire Programming 156 19-01-2005 21:42
Printf warning during compile? actorindp Programming 4 20-02-2004 17:02
How to measure execution time? And code size? gnormhurst Programming 17 17-02-2004 08:06
Can't Compile the Default Code pressurex1 Programming 4 25-01-2004 20:26
Problem with FRC Default code AsimC Programming 2 11-01-2004 19:22


All times are GMT -5. The time now is 08:00.

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