"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.

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.


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

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).