template <class Timer>
class VitalsPublisher {
public:
/**
* @typedef publish_fn_t
* @brief A function requiring no parameters and returning a \p system_error_t
*/
typedef std::function<int(void)> publish_fn_t;
/**
* @brief Constructor
*
* @param[in] publish_fn The function used to send cloud messages
* @param[in] timer The timer used to schedule the period
*/
VitalsPublisher (
publish_fn_t publish_fn,
const Timer & timer
);
/**
* @brief Destructor
*
* The destructor ensures the resources allocated during the
* scheduling of events are returned to the system.
*/
virtual
~VitalsPublisher (
void
);
...
CMakeFiles/publish_vitals.dir/publish_vitals.cpp.o: In function `____C_A_T_C_H____T_E_S_T____0()':
publish_vitals.cpp:(.text+0x25a88): undefined reference to `system::VitalsPublisher<fakeit::Mock<interface::Timer> >::VitalsPublisher(std::function<int ()>, fakeit::Mock<interface::Timer> const&)'
publish_vitals.cpp:(.text+0x25c6c): undefined reference to `system::VitalsPublisher<fakeit::Mock<interface::Timer> >::~VitalsPublisher()'
publish_vitals.cpp:(.text+0x25d74): undefined reference to `system::VitalsPublisher<fakeit::Mock<interface::Timer> >::~VitalsPublisher()'
collect2: error: ld returned 1 exit status
This is my first time with Fakeit, so I'm not certain I'm using it correctly or if I am experiencing a limitation of the framework? If this is a limitation, is there a workaround?
It appears this is a problem with my templating and not with Fakeit. I felt obligated to share the mistake here in case someone else begins down this path.
Test Code:
Constructor and Destructor signatures:
Compile Instruction:
Linker Error:
This is my first time with Fakeit, so I'm not certain I'm using it correctly or if I am experiencing a limitation of the framework? If this is a limitation, is there a workaround?