Go to Post Nascar was one of the first things i though when the unveiled this years competitions...... silly left turns... they hurt right turns feelings :rolleyes: - Miniflash [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 15-01-2007, 15:20
xrabohrok's Avatar
xrabohrok xrabohrok is offline
hunter of errors
FRC #1208 (The Metool Brigade)
Team Role: Programmer
 
Join Date: Jan 2006
Location: O'Fallon
Posts: 62
xrabohrok is an unknown quantity at this point
"extern" linking issues.

It's me and my silly errors again. This time it has to do with variable types.
This error originates from trying to use an "extern" variable extension to get data from the tracking.c file. This should theoretically work, but it doesn't.

I get an error that reads (abridged):
Fatal[151] -internal- populateExternalReferences() -symbol 'virtual_servo_tilt' is not an external reference.

I declare both instances of the variable in each file, I used a .h file to declare the variable, and I include the .h file in both .c files. (For the record, it's tracking.h).

You guys have been wonderfully patient with me, and I thank you people.
__________________
"It's programming's fault" may be a viable excuse for just about everything, except the robot falling apart.

It will 'cause it can!

constants aren't. variables won't.
  #2   Spotlight this post!  
Unread 15-01-2007, 15:51
JSonntag JSonntag is offline
Registered User
FRC #0486 (Positronic Panthers)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: United States
Posts: 16
JSonntag is on a distinguished road
Send a message via AIM to JSonntag
Re: "extern" linking issues.

go to the .c file that you are trying to get the data to and at the top, declare an extern variable that is the same name as the variable in the tracking.c file.

example:

say in tracking.c i have a global variable called servo_position that i want to get to user_routines.c

i just go to user routines and type:

extern unsigned char servo_position;

then i can use the variable in user_routines.c

you do not put extern in front of the variable in tracking.c or else you will get an error
  #3   Spotlight this post!  
Unread 15-01-2007, 16:00
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: "extern" linking issues.

You probably have something like "extern int myvariable;" in each file.

Note that you must also have "int myvariable" in one file (the owner of the variable) and it should be global and static in scope (not embedded in a function).

Regards,

Mike
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
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
New NEMO White Papers! "Creating a Killer Packet" and "25 Ways to Sponsor" Jessica Boucher Team Organization 0 10-08-2005 10:55
Linking Errors: "section '????' can not fit the section. ..." Astronouth7303 Programming 3 16-01-2005 21:36
"Thunderbirds" Vs. "Team America" Which one will rule the box office? Elgin Clock Chit-Chat 3 07-09-2004 19:53
Conflict between "Initialize_Tracker()" and "pwm13 & pwm15"? Kevin? gnormhurst Programming 3 22-02-2004 02:55
how tall is the ramp when in "up" and "balanced" position??? archiver 2001 1 24-06-2002 00:54


All times are GMT -5. The time now is 11:04.

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