0

I have a large collection of libraries that compile correctly but won't link. I am using Visual Micro for Visual Studio 2015. Here is the complete collection of error messages:

CommandPattern3.cpp.o:In function `DualMotorRomeo
DualMotorRomeo.h:undefined reference to `vtable for DualMotorRomeo
DualMotorRomeo.h:undefined reference to `vtable for DualMotorRomeo
CommandPattern3.cpp.o:In function `__static_initialization_and_destruction_0
CommandPattern3.ino:undefined reference to `DualMotorRomeo  ~DualMotorRomeo()
collect2.exe*:error: ld returned 1 exit status

Error compiling for board Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)

I have been through the code with a fine toothed comb, but cannot see what references are undefined.

Is there some Windows 10 utility that can examine the vTables and help me find what is missing?

The code base is too large to post, but I can provide a ZIP file with all the code in it for anyone willing to help.

1
  • The linker is trying hard to help you. Check DualMotorRomeo.h and that there is a destructor (might need to be virtual depending on the inheritance?). Commented Jul 23, 2016 at 7:54

1 Answer 1

1

I don't have the header file for DualMotorRomeo, but the linker is saying that a destructor has been declared (~DualMotorRomeo()) in the class header, but no destructor has been defined. If you didn't write DualMotorRomeo then the library needs to be updated.

Until then, simply add the following to one of your source files:

DualMotorRomeo::~DualMotorRomeo() {
} // DualMotorRomeo::~DualMotorRomeo()

That will also fix the vtable linker errors - the vtable will be included in the compiled file with this declared in it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.