|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Warning: module holds reference to undefined symbol
While using Command Based Robot code I am getting the following error for each of my SubSystems
Warning: module [what I guess is an address in the symbol table] holds reference to undefined symbol [some number]CommandBase[Hex Value][name of symbol] It then unloads the FRC_UserProgram.out causing a "No Robot Code" error. Now the weird part, on a whim I changed the reference name (via the refactor menu) to something different. The error never changed. I searched for every instance the old name and none were found. This makes me question whether the updated code is being put onto the robot. Any advice is appreciated. |
|
#2
|
||||
|
||||
|
Re: Warning: module holds reference to undefined symbol
Quote:
So you are loading a kernel module that has a symbol in it that cannot be resolved against the symbol tables of all modules (and the kernel) already in memory. From your description, the symbol is a mangled C++ symbol. When you build the command-based code, do you need to pre-link a library with your application code (with a -l parameter on the linker command line)? I will look at the command-based stuff and get back to you. HTH |
|
#3
|
||||
|
||||
|
Re: Warning: module holds reference to undefined symbol
The command-based robot does not link to any extra libraries, only to WPILib.a, so that is not the problem. Do you include a customized version of CommandBase.cpp in your project? I see that class has 3 static members - init, OI and examplesubsystem)? Do you have instances of all 3 declared somewhere?
|
|
#4
|
|||
|
|||
|
Re: Warning: module holds reference to undefined symbol
Quote:
Code:
#include "CommandBase.h"
#include "Commands/Scheduler.h"
CommandBase::CommandBase(const char *name) : Command(name) {
}
CommandBase::CommandBase() : Command() {
}
// Initialize a single static instance of all of your subsystems to NULL
OI* CommandBase::oi = NULL;
DriveTrain *CommandBase::chassis = NULL;
Elevator *CommandBase::elevator = NULL;
Intake *CommandBase::intake = NULL;
Shooter *CommandBase::shooter = NULL;
void CommandBase::init() {
// Create a single static instance of all of your subsystems. The following
// line should be repeated for each subsystem in the project.
//examplesubsystem = new ExampleSubsystem();
chassis = new DriveTrain();
elevator = new Elevator();
intake = new Intake();
shooter = new Shooter();
oi = new OI();
}
Code:
#ifndef COMMAND_BASE_H
#define COMMAND_BASE_H
#include "Commands/Command.h"
#include "Subsystems/DriveTrain.h"
#include "Subsystems/Elevator.h"
#include "Subsystems/Intake.h"
#include "Subsystems/Shooter.h"
#include "OI.h"
/**
* The base for all commands. All atomic commands should subclass CommandBase.
* CommandBase stores creates and stores each control system. To access a
* subsystem elsewhere in your code in your code use CommandBase.examplesubsystem
*/
class CommandBase: public Command {
public:
CommandBase(const char *name);
CommandBase();
static void init();
// Create a single static instance of all of your subsystems
static DriveTrain *chassis;
static Elevator *elevator;
static Intake *intake;
static Shooter *shooter;
static OI *oi;
};
#endif
|
|
#5
|
||||
|
||||
|
Re: Warning: module holds reference to undefined symbol
That looks correct to me. Are all your subsystem classes complete or stubbed out?
Maybe try commenting out your additions till the module will load? |
|
#6
|
|||
|
|||
|
Re: Warning: module holds reference to undefined symbol
Quote:
I attempted the commenting out solution, none of the modules would load. |
|
#7
|
|||||
|
|||||
|
Re: Warning: module holds reference to undefined symbol
In this thread from a couple years ago the poster had a similar problem. For him, doing a clean reinstallation of WindRiver and all the updates fixed the issue. I would try installing WindRiver to its default directory for good measure.
|
|
#8
|
||||
|
||||
|
Re: Warning: module holds reference to undefined symbol
Time to check with the author I reckon - perhaps try the nmppc utility and see if you can identify the unmangled symbol name? Is the 4 Feb update required to support the command-based templates? And if so, is your development environment up to date?
|
|
#9
|
||||
|
||||
|
Re: Warning: module holds reference to undefined symbol
Where in the project do you right-click? I don't see the "Create New SubSystem" option.
|
|
#10
|
|||
|
|||
|
Re: Warning: module holds reference to undefined symbol
There is additional software you have to install (see the WPILib Cookbook for instructions). You click on the project name.
|
|
#11
|
||||
|
||||
|
Re: Warning: module holds reference to undefined symbol
Hey - we do something like this but it is all home brewed. It cleanly separates the behaviors into classes/tasks though and uses a message passing mechanism to isolate each function. It makes life much easier for the student programmers, they can focus on simple tasks as if they were a single program.
PM me an e-mail address and we'd be glad to share the current code with you. |
|
#12
|
|||
|
|||
|
Re: Warning: module holds reference to undefined symbol
have you declared all the static members somewhere other than the class definition? it's a dumb problem with c++ but if you dont, the compiler wont actually create a symbol for the static class member.
|
|
#13
|
||||
|
||||
|
Re: Warning: module holds reference to undefined symbol
I'll throw my 2 cents in. We've had some whacky problem in the past which were never fully explained, but sometimes doing a Project->Clean... will rinse out the garbage and get you back to sanity. I would suggest doing it as there should be no ill effects from a clean at all and only potential up-side.
bob |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|