Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   C++ programming help (http://www.chiefdelphi.com/forums/showthread.php?t=154839)

dr8giblekri 06-02-2017 16:35

C++ programming help
 
so, Ive searched and searched and cant find anything about an error im having (I'm probably not searching in the right places or using the right keywords:yikes:). the error says:


undefined reference to `vtable for Robot'


it occurs in two places:
here: class Robot: public SampleRobot
and then at the end closing bracket from when i define the encoders.

any help is appreciated :D :D .

gerthworm 06-02-2017 16:41

Re: C++ programming help
 
I'd need full code to know for sure, but I suspect this is due to something which should be commented out, but isn't?

Search your codebase for the string "vtable for Robot" and see if you're either missing comments, quotes, etc.

FYI, "undefined reference to" is usually the linker saying "I see you have some code object name defined, but I can't figure out where it's declared"... I find it weird that it would pick up a whole string like that, so I might be off in the weeds here....

SoftwareBug2.0 06-02-2017 17:04

Re: C++ programming help
 
Quote:

Originally Posted by gerthworm (Post 1641273)
Search your codebase for the string "vtable for Robot" and see if you're either missing comments, quotes, etc.

This is not likely to be something named "vtable" in their code. A vtable is used by the compiler to keep track of all the virtual (that's where the "v" in "vtable" comes from) functions and related parts that make up a class.

gerthworm 06-02-2017 17:27

Re: C++ programming help
 
Hmmm, it appears I was off in the weeds myself. I suppose that's what happens when I attempt to answer a C++ question when it's not my first language...

http://stackoverflow.com/questions/3...ence-to-vtable and the linked https://gcc.gnu.org/faq.html#vtables have some info, but it's not stuff I'm super familiar with....

dr8giblekri 06-02-2017 18:28

Re: C++ programming help
 
thanks for the help guys. i'll keep looking around then i'll share what i find with you guys for future references.

alst 06-02-2017 20:14

Re: C++ programming help
 
This error often shows up when you've forgotten to define virtual methods. In this case, since your Robot class inherits from SampleRobot, you should have definitions for at least one of RobotInit(), Disabled(), Autonomous(), OperatorControl(), Test(), or RobotMain(). If you've defined some of these, make sure they're spelled/capitalized correctly and are defined inside the robot class (or qualified, e.g. with "void Robot::Autonomous(){...}").

If that doesn't help, it would be helpful if you could post your code somewhere (or at least a portion that reproduces the issue).

dr8giblekri 07-02-2017 10:52

Re: C++ programming help
 
i've figured out the error...well...one of the mentors did...

the problem was that something was remmed out and it was still reading as if that code was there, which was duplicating the code we had above it.

thanks for all your help!!:D ::rtm:: ::rtm::


All times are GMT -5. The time now is 22:36.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi