View Single Post
  #1   Spotlight this post!  
Unread 20-01-2013, 09:57
kenfox kenfox is offline
Registered User
FRC #3322 (Eagle Imperium)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Ann Arbor, MI
Posts: 51
kenfox is a glorious beacon of lightkenfox is a glorious beacon of lightkenfox is a glorious beacon of lightkenfox is a glorious beacon of lightkenfox is a glorious beacon of light
No Robot Code may be caused by link error

We had a problem running C++ code on the robot. The project built and deployed without errors. We could FTP to the cRIO and verify the out file matched what we deployed. The driver station had communication, but did not have robot code.

The problem was a declared but undefined static class variable that prevented VxWorks from loading the out file. Link errors don't appear to be logged anywhere. I couldn't see the error in Net Console.

We found the problem by setting up a debug target and running in debug mode. The instructions at http://wpilib.screenstepslive.com/s/...-robot-program worked great. When WindRiver tried to attach to our code, it showed an error dialog with the name of the undefined variable. It was name mangled, but pretty easy to figure out. The program "c++filtppc" will unmangle names for you if you can't figure out the C++ variable from the mangled name.

Here's an example of a static class variable declaration (in the h file):
Code:
class MyRobot: public IterativeRobot {
public:
  static MySubsystem* mySubsystem;
};
And here's the definition that we were missing (in the cpp file):
Code:
MySubsystem* MyRobot::mySubsystem = 0;
Hope this helps someone!
Reply With Quote