Linker doesn't link cpp files

So I tried to construct an instance of an object in my main file, and upon compiling I’m hit with a series of errors, saying it can’t find any of the class’ methods. Upon some investigation, it seems the linker isn’t actually linking its object file, and as such, all the method prototypes point to nothing.

Here’s the code:

#include <Arduino.h>
#include "product/controller.hpp"
#include "product/pusher.hpp"

#ifndef UNIT_TEST // important line, do not remove

controller contr; // this is the line causing issues

void setup() {
  contr.register_component(pusher(10, 11));
}

void loop() {

}

#endif // important line, do not remove

And here’s the output log (the relevant bit):

Linking .pioenvs/megaatmega2560/firmware.elf
.pioenvs/megaatmega2560/src/main.o: In function `__static_initialization_and_destruction_0':
/home/coffee/Documents/sw5-sorting/src/main.cpp:7: undefined reference to `controller::controller()'
/home/coffee/Documents/sw5-sorting/src/main.cpp:7: undefined reference to `controller::~controller()'
.pioenvs/megaatmega2560/src/product/component.o:(.rodata._ZTV9component[vtable for component]+0x6): undefined reference to `compone
nt::operator==(component) const'
.pioenvs/megaatmega2560/src/product/pusher.o:(.rodata._ZTV6pusher[vtable for pusher]+0x6): undefined reference to `component::opera
tor==(component) const'
.pioenvs/megaatmega2560/src/product/sensor.o:(.rodata._ZTV6sensor[vtable for sensor]+0x6): undefined reference to `component::opera
tor==(component) const'
collect2: error: ld returned 1 exit status
*** [.pioenvs/megaatmega2560/firmware.elf] Error 1
========================== [ERROR] Took 4.23 seconds ==========================

So what’s the issue here, why can it not link my object file? Or is there perhaps something more fundamental wrong with it?

Please provide the full output using --verbose mode and share on http://pastebin.com

Not sure how, I’m using the IDE to handle all this stuff. I never used the compiler from the CLI

Okay, here’s the verbose output as requested: [Mon Oct 31 15:26:36 2016] Processing megaatmega2560 (platform: atmelavr, board: - Pastebin.com

I don’t see any errors in the latest build output. Please check your source code. Looks like you have broken implementation.

It appears you are right!

Have you resolved this issue?

I have. There wasn’t anything wrong with the linker.