I'll say this at the start: yes, the base class's constructor is defined.
We are writing unit tests for a project that is to run in both Windows and QNX. I do my work in VS on Windows, and then when I'm done and everything works, I load it in QNX Momentics and make sure that builds. This is the first time I'm trying the QNX build. It appears to only maybe show one error at a time? Anyway, here's where I'm stuck:
I get the following errors highlighting the definition of the constructor and destructor of RoutineTest
Debug/Source/RoutineTest.o: In function `Test::RoutineTest::RoutineTest()':
RoutineTest.cpp:7: undefined reference to `TimerTest::TimerTest()'
Debug/Source/RoutineTest.o: In function `Test::RoutineTest::~RoutineTest()':
RoutineTest.cpp:12: undefined reference to `TimerTest::~TimerTest()'
But everything works fine in Windows. And everything is defined and declared and all that, and I don't know why it's not working.
RoutineTest.h
#ifndef ROUTINE_H
#define ROUTINE_H
#include "gtest/gtest.h"
#include "../Timer/TimerTest.h"
namespace Test
{
// inherit from TimerTest to get timer members for free (TimerTest::singleTimer)
class RoutineTest : public TimerTest
{
public:
RoutineTest();
virtual ~RoutineTest();
protected:
virtual void SetUp() override;
virtual void TearDown() override;
};
}
#endif //ROUTINE_H
RoutineTest.cpp
#include "RoutineTest.h"
#include "../Timer/TimerTest.h"
namespace Test
{
RoutineTest::RoutineTest() {}
RoutineTest::~RoutineTest() {}
void RoutineTest::SetUp() {}
void RoutineTest::TearDown() {}
}
TimerTest.h
(excerpt)
#pragma once
#include "gtest/gtest.h"
#include "Timer.h"
using namespace Framework;
class TimerTest : public testing::Test
{
public:
TimerTest();
virtual ~TimerTest();
protected:
virtual void SetUp();
virtual void TearDown();
std::shared_ptr<Timer> periodicTimer;
std::shared_ptr<Timer> singleTimer;
};
TimerTest.cpp
(excerpt)
#include "TimerTest.h"
using namespace Framework;
TimerTest::TimerTest() :
periodicTimer ( nullptr ),
singleTimer ( nullptr )
{
// code, yes real code, it's not empty
}
TimerTest::~TimerTest()
{
// code, yes real code, it's not empty
}
I'm relatively new to C++, and completely new to QNX, but I feel like this problem shouldn't be happening.
Here is the build log:
10:38:12 **** Build of configuration Debug for project FrameworkUnitTests ****
make -j8 all
make -C ../../../framework/projects/qnx all
make[1]: Entering directory 'C:/Software_Projects/proj/framework/framework/projects/qnx'
make -C ../../../adaptor/projects/qnx all
make[2]: Entering directory 'C:/Software_Projects/proj/framework/adaptor/projects/qnx'
make -C ../../../core/projects/qnx all
make[3]: Entering directory 'C:/Software_Projects/proj/framework/core/projects/qnx'
C:Software_Projectsprojframeworkcoreprojectsqnx>(echo Thu 01/28/2021 10:38:14.60 "libCore.a" 1>>"........uildLog.txt" ) 2>nul && exit /b 0
Directory ....sourceproduct*.hpp
make Debug/libCore.a
make[4]: Entering directory 'C:/Software_Projects/proj/framework/core/projects/qnx'
make[4]: 'Debug/libCore.a' is up to date.
make[4]: Leaving directory 'C:/Software_Projects/proj/framework/core/projects/qnx'
make[3]: Leaving directory 'C:/Software_Projects/proj/framework/core/projects/qnx'
... a bunch of AStyle stuff here...
make Debug/libFramework.a
make[2]: Entering directory 'C:/Software_Projects/proj/framework/framework/projects/qnx'
qcc -V5.4.0,gcc_ntoarmv7le -c -Wp,-MMD,Debug/Source/DataItemBase.d,-MT,Debug/Source/DataItemBase.o -o Debug/Source/DataItemBase.o -I../../source/product -I../../source/product/Application -I../../source/product/Boot -I../../source/product/Configuration -I../../source/product/Data -I../../source/product/DDS -I../../source/product/Delegates -I../../source/product/Domain -I../../source/product/Exceptions -I../../source/product/HAL -I../../source/product/Logging -I../../source/product/OS -I../../source/product/Rules -I../../source/product/StateMachine -I../../source/product/ThreadedObject -I../../source/product/Utility -I../../dependencies/vendor_rti_dds_release/h -I../../dependencies/vendor_rti_dds_release/h/ndds -I../../dependencies/vendor_rti_dds_release/h/ndds/hpp -I../../../adaptor/source/product -I../../../adaptor/source/product/HAL -I../../../adaptor/source/product/HAL/qnx -I../../../adaptor/source/product/OS -I../../../adaptor/source/product/OS/qnx -I../../../adaptor/source/product/Utility -I../../../adaptor/source/product/Utility/qnx -I../../../core/source/product -I../../../core/source/product/Errors -I../../../core/source/product/Exceptions -I../../../core/source/product/Logging -I../../../core/source/product/Protocols -I../../../core/source/product/Trace -D_QNX_SOURCE -DRTI_QNX -Wall -Wno-switch -Wno-parentheses -Wno-unused -Werror -p -g -O0 -finstrument-functions -std=c++14 ../../source/product/Data/DataItemBase.cpp
qcc -V5.4.0,gcc_ntoarmv7le -A Debug/libFramework.a -Wall -Wno-switch -Wno-parentheses -Wno-unused -p -g Debug/Source/SingletonBase.o Debug/Source/JsonParser.o Debug/Source/JsonNode.o Debug/Source/ConfigurationBase.o Debug/Source/DDSQosHelper.o Debug/Source/DDSTypeRegistrar.o Debug/Source/DDSName.o Debug/Source/DDSFactory.o Debug/Source/DDSMonitorFactory.o Debug/Source/DDSLoggingLookup.o Debug/Source/DDSDataItemBase.o Debug/Source/ExitRoutine.o Debug/Source/PrintDataRoutine.o Debug/Source/Routine.o Debug/Source/HistoryRoutine.o Debug/Source/CommandLineInterface.o Debug/Source/PatientCart.o Debug/Source/AudioVolume.o Debug/Source/MastHeight.o Debug/Source/BoomBrakeButtons.o Debug/Source/UPS.o Debug/Source/BspVersions.o Debug/Source/ESUState.o Debug/Source/FootPedals.o Debug/Source/WSDisplay.o Debug/Source/SoftwareVersions.o Debug/Source/Shutdown.o Debug/Source/DisplayShutdown.o Debug/Source/Overlay.o Debug/Source/PrimaryVideo.o Debug/Source/SoupVersions.o Debug/Source/Ergonomics.o Debug/Source/MasterControllers.o Debug/Source/Test.o Debug/Source/HardwareVersions.o Debug/Source/CitIllumination.o Debug/Source/CentralUnit.o Debug/Source/ValueWidget.o Debug/Source/Kinematics.o Debug/Source/EndoscopeMotor.o Debug/Source/Transfer.o Debug/Source/Visualization.o Debug/Source/HandPiece.o Debug/Source/EndoscopeMotors.o Debug/Source/MotorPosition.o Debug/Source/BoomBrakes.o Debug/Source/LEDButton.o Debug/Source/AppInfo.o Debug/Source/FootTrayTilt.o Debug/Source/Workstation.o Debug/Source/ESUInstrument.o Debug/Source/MasterController.o Debug/Source/SledMotors.o Debug/Source/Tether.o Debug/Source/Hardware.o Debug/Source/PrimaryDisplay.o Debug/Source/OnOffWidget.o Debug/Source/PCDisplay.o Debug/Source/DisplayButton.o Debug/Source/HardwareInfo.o Debug/Source/DomainModel.o Debug/Source/EndoscopeIllumination.o Debug/Source/HighAvailabilityManager.o Debug/Source/OsEnv.o Debug/Source/TimerService.o Debug/Source/Mutex.o Debug/Source/Directory.o Debug/Source/ExePath.o Debug/Source/OsVersion.o Debug/Source/ThreadSafeNotify.o Debug/Source/LoopRateGovernor.o Debug/Source/Timer.o Debug/Source/ThreadBase.o Debug/Source/TickSource.o Debug/Source/QueueIPC.o Debug/Source/ThreadedObjectTrigger.o Debug/Source/ThreadService.o Debug/Source/CRCCalculatorForFile.o Debug/Source/AudioPlayer.o Debug/Source/BasicTimerAPIBase.o Debug/Source/StopwatchWithTimeStats.o Debug/Source/LocalTime.o Debug/Source/CRCCalculator.o Debug/Source/JitterTracker_ForPeriod.o Debug/Source/StringHelper.o Debug/Source/JitterTracker.o Debug/Source/JitterTracker_ForDuration.o Debug/Source/EngineRule_OR.o Debug/Source/RulePluginDdsGenericBool.o Debug/Source/RulePluginLocalApiCallBool.o Debug/Source/RulePlugin.o Debug/Source/RulePluginGpioBool.o Debug/Source/EngineRule_AND.o Debug/Source/Latch.o Debug/Source/LatchFactory.o Debug/Source/BinaryRulesEngine.o Debug/Source/UartThreadRx.o Debug/Source/I2cMask.o Debug/Source/PWMInstance.o Debug/Source/SpiFactory.o Debug/Source/CanThreadTx.o Debug/Source/UartDriver.o Debug/Source/UartMask.o Debug/Source/I2cFactory.o Debug/Source/SpiMask.o Debug/Source/UartThreadTx.o Debug/Source/AudioDriver.o Debug/Source/SpiDriver.o Debug/Source/CanFactory.o Debug/Source/GPIOFactory.o Debug/Source/I2cDriver.o Debug/Source/CanDriver.o Debug/Source/UartFactory.o Debug/Source/AudioThread.o Debug/Source/I2cThread.o Debug/Source/GPIOInstance.o Debug/Source/CanMask.o Debug/Source/CanThreadRx.o Debug/Source/ProcessorTemperatureDriver.o Debug/Source/ReceiveWatcher.o Debug/Source/PWMFactory.o Debug/Source/Debounce.o Debug/Source/SpiDevice.o Debug/Source/AspectFactory.o Debug/Source/Aspects.o Debug/Source/Aspect_Writeable.o Debug/Source/AspectBase.o Debug/Source/DataItemBase.o Debug/Source/DataStore.o Debug/Source/Aspect_Readable.o Debug/Source/Aspect_Safety.o Debug/Source/Aspect_Mutex.o Debug/Source/Aspect_Unique.o Debug/Source/BootManager.o Debug/Source/CommandLineParser.o Debug/Source/DependencyInjector.o Debug/Source/DependencyInjectorHelper.o Debug/Source/JitterTrackerParser.o Debug/Source/SampleStatsTable.o Debug/Source/LogPrintParagraph.o Debug/Source/CircularFile.o Debug/Source/LogFile_MsgQ.o Debug/Source/LogPrintCSV.o Debug/Source/DiskFile.o Debug/Source/LogFileBase.o Debug/Source/LogFile_BlackHole.o Debug/Source/LogFile_Iostream.o Debug/Source/LogTypeConverter.o Debug/Source/LogFile_FanOut.o Debug/Source/LogFactory.o Debug/Source/LogPrintBase.o Debug/Source/ExceptionHandler.o Debug/Source/StateMachineBase.o Debug/Source/StateBase.o Debug/Source/Delegates_StaticAnalysis.o Debug/Source/Domain.o Debug/Source/DomainPlugin.o -lprofilingS
C:Userscookqnx700hostwin64x86_64usrinarm-unknown-nto-qnx7.0.0eabi-ar: creating Debug/libFramework.a
make[2]: Leaving directory 'C:/Software_Projects/proj/framework/framework/projects/qnx'
make[1]: Leaving directory 'C:/Software_Projects/proj/framework/framework/projects/qnx'
C:Software_Projectsprojframeworkframeworkprojectsqnx-unittest>(echo Thu 01/28/2021 10:38:31.66 "FrameworkUnitTests" 1>>"........uildLog.txt" ) 2>nul && exit /b 0
... a bunch more AStyle stuff here...
Directory ....sourceestunitFrameworkUnitTests*.hpp
make Debug/FrameworkUnitTests
make[1]: Entering directory 'C:/Software_Projects/proj/framework/framework/projects/qnx-unittest'
qcc -V5.4.0,gcc_ntoarmv7le -c -Wp,-MMD,Debug/Source/DataItemUnitTests.d,-MT,Debug/Source/DataItemUnitTests.o -o Debug/Source/DataItemUnitTests.o -I../../dependencies/vendor_rti_dds_release/h -I../../dependencies/vendor_rti_dds_release/h/ndds -I../../dependencies/vendor_rti_dds_release/h/ndds/hpp -I../../../adaptor/source/product -I../../../adaptor/source/product/HAL -I../../../adaptor/source/product/HAL/qnx -I../../../adaptor/source/product/OS -I../../../adaptor/source/product/OS/qnx -I../../../adaptor/source/product/Utility -I../../../adaptor/source/product/Utility/qnx -I../../../core/source/product -I../../../core/source/product/Errors -I../../../core/source/product/Exceptions -I../../../core/source/product/Logging -I../../../core/source/product/Protocols -I../../../core/source/product/Trace -I../../../framework/source/product -I../../../framework/source/product/Application -I../../../framework/source/product/Boot -I../../../framework/source/product/Configuration -I../../../framework/sour