Go to Post One last thing, if a mechanical part fails on you, sometimes you can get a little bit of noise back into it by yelling at it, kicking it, or pounding on it with your fist. This might put enough back into it so it will work for a few more minutes. - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-26-2010, 12:04 AM
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Help interpreting load time error

I have started to customize the robot template for our team. I have sub-classed the SimpleRobot class to add some of our custom functions. Everything compiled and the code was downloaded into the cRIO fine. But when I rebooted the robot, at the end of the boot, it gave me the following output and I have no idea why TrcRobot is undefined. TrcRobot is my subclass of SimpleRobot. Simplified code construct is shown below. I am expecting to see compiler errors if I made mistakes. But the compiler didn't complain and instead I got load time error of undefined symbol. Can somebody tell me what it means? Thanks.
Code:
FRC_NetworkCommunication was compiled from SVN revision 2064
FPGA Hardware GUID: 0xAD9A5591CC64E4DF756D77D1B57A549E
FPGA Software GUID: 0xAD9A5591CC64E4DF756D77D1B57A549E
FPGA Hardware Version: 2010
FPGA Software Version: 2010
FPGA Hardware Revision: 1.3.0
FPGA Software Revision: 1.3.0
* Loading StartupDlls: FRC_UserProgram
Warning: module 0x134c5d0 (FRC_UserProgram.out) holds reference to undefined symbol _ZTV8TrcRobot.
Warning: module 0x134c5d0 (FRC_UserProgram.out) holds reference to undefined symbol _ZTI8TrcRobot.
(unloading partially loaded module FRC_UserProgram.out)
...FRC_UserProgram failed to load.
Code:
class TrcRobot: public SimpleRobot
{
public:
    virtual void SomeCustomizedMethods();
    void Autonomous()
    {
        //Autonomous main loop.
        SomeCustomizedMethods();
    }
    void OperatorControl()
    {
        //Operator control main loop.
        SomeCustomizedMethods();
    }
};

class MyRobot: public TrcRobot
{
    MyRobot()
    {
        //Instantiate other objects.
    }
    ~MyRobot()
    {
        //Destroy objects created in constructor.
    }
    void SomeCustomizedMethods()
    {
        //Autonomous or Operator Control tasks.
    }
}
START_ROBOT_CLASS(MyRobot);
Reply With Quote
  #2   Spotlight this post!  
Unread 01-26-2010, 11:08 AM
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: Help interpreting load time error

I have a few things:
  • This is only slightly related to your problem, but if you're going to implement an Autonomous() or OperatorControl() in MyRobot, you'll need to make these functions virtual in TrcRobot. The deconstructor for MyRobot (MyRobot::~MyRobot) also won't be called unless you make a virtual deconstructor in TrcRobot. Make sure to check inheritence for stuff like this.
  • An "undefined symbol" basically means that the program can't find a function or piece of code where it thinks there should be one. This could be caused by different things:
    • A header file contains the definition of a function, and the source files either don't have the function at all or the function has a different definition in the source files. (This is usually caught during compile-time though).
    • Your versions are off. The code's looking for something in the WPI library where it shouldn't be. Make sure both your robot and your WindRiver workbench have the newest updates.

Taking a second look at it, though, I thought of this:

Since the undefined symbol is "_ZTV8TrcRobot.", I'd guess this is caused by neither of the above possibilities, but something involving inheritance. Put constructors in both TrcRobot and MyRobot (you only have one in MyRobot right now). The START_ROBOT_CLASS macro instantiates the class you give it, which will call not just call the base constructor SimpleRobot::SimpleRobot() but also TrcRobot::TrcRobot() and MyRobot::MyRobot(). I'm guessing that after calling the SimpleRobot constructor it looks for the TrcRobot constructor and freaks out when there isn't one.

Let me know if this fixes the problem.
__________________

Last edited by slavik262 : 01-26-2010 at 11:30 AM.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-26-2010, 04:02 PM
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Help interpreting load time error

Yes, I have constructors on both MyRobot and TrcRobot (sorry that I simplified too much and did not show them in my code example). I suspect about inheritance too. So if the undefined symbol means it could not find the constructor of TrcRobot, I am puzzled because it's there. I am going to cut everything non-essential out to isolate the problem tonight and see what it is really complaining.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-26-2010, 04:40 PM
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: Help interpreting load time error

Cool. If I can help any more, feel free to post here or PM me.
__________________
Reply With Quote
  #5   Spotlight this post!  
Unread 01-27-2010, 01:52 AM
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Help interpreting load time error

Quote:
Originally Posted by mikets View Post
I am expecting to see compiler errors if I made mistakes. But the compiler didn't complain and instead I got load time error of undefined symbol. Can somebody tell me what it means? Thanks.
The reason the compiler (it's actually the linker that would complain) is not giving you an error is that VxWorks links at load time instead of requiring a stub library for external linkage. Any symbols that are not defined when building are simply assumed to exist in the environment that you program will load in. If that does not hold true, you get errors from the loader.
Reply With Quote
  #6   Spotlight this post!  
Unread 01-27-2010, 04:15 AM
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Help interpreting load time error

I see. That makes sense now. So according to the linker error, am I missing the constructor of TrcRobot then?
Reply With Quote
  #7   Spotlight this post!  
Unread 01-27-2010, 04:49 AM
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Help interpreting load time error

No... it's not the constructor. It's the vtable and the typeinfo.

If you run the tool C:\WindRiver\gnu\3.4.4-vxworks-6.3\x86-win32\bin\c++filtppc.exe and pass in the mangled name, it will tell you what it is in plain text.
Reply With Quote
  #8   Spotlight this post!  
Unread 01-27-2010, 11:00 PM
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Help interpreting load time error

Yes, you are right, it is the typeinfo and vtable. But what does it mean if these symbols are missing? TrcRobot is the base class of MyRobot. Why would the vtable of the TrcRobot be missing?
Reply With Quote
  #9   Spotlight this post!  
Unread 01-28-2010, 06:06 PM
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Help interpreting load time error

Quote:
Originally Posted by mikets View Post
Yes, you are right, it is the typeinfo and vtable. But what does it mean if these symbols are missing? TrcRobot is the base class of MyRobot. Why would the vtable of the TrcRobot be missing?
You have not included the actual code, so it's a little hard to say, but I would speculate that you don't have a virtual destructor defined for TrcRobot. Since the RobotBase and SimpleRobot destructors are virtual and TrcRobot inherits from them and is then inherited from by MyRobot, you must have a virtual destructor at all levels of the hierarchy. Leaving it out of one class in the middle won't work. The default destructor is not virtual.

-Joe
Reply With Quote
  #10   Spotlight this post!  
Unread 01-28-2010, 06:10 PM
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Help interpreting load time error

Yes, I found it out yesterday. I thought I had an empty destructor defined but I missed that one. Thanks for the help.
Reply With Quote
Reply


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
Resolve load conflict error ? ferc Programming 1 01-15-2010 09:16 PM
Help getting C++ program to load tgwicklund C/C++ 4 02-02-2009 11:24 PM
**FIRST EMAIL**/Important Pit Load In and Load Out Information Mark McLeod FIRST E-Mail Blast Archive 7 04-11-2008 08:16 AM
HELP!!!!! Taigene motor load DPTeam270Driver Motors 40 02-12-2008 10:53 AM
180:Error: syntax error help! seanl Programming 8 02-04-2007 11:31 AM


All times are GMT -5. The time now is 09:20 AM.

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