Link error when subclassing NullFederateAmbassador

194 views Asked by At

I am trying to write my own RTI implementation in C++.

I imported the IEEE 1516 HLA evolved API, and created a subclass of NullFederateAmbassador.

I get 60+ unresolved external symbol errors, attached below.

The only C++ I have written is this:

#include "pch.h"
#include "RTI/RTI1516.h"
#include "RTI/NullFederateAmbassador.h"

using namespace rti1516e;

class NullFederateAmbassadorChild : public NullFederateAmbassador {

};

void Connect() {
    NullFederateAmbassadorChild c;
}

The code connects fine in IntelliSense. My pch.h has nothing in it. The RTI file is completley unchanged from the original RTI files that came from IEEE.

1>CBRTILibrary.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl rti1516e::NullFederateAmbassador::NullFederateAmbassador(void)" (__imp_??0NullFederateAmbassador@rti1516e@@QEAA@XZ) referenced in function "public: __cdecl NullFederateAmbassadorChild::NullFederateAmbassadorChild(void)" (??0NullFederateAmbassadorChild@@QEAA@XZ)
1>CBRTILibrary.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl rti1516e::NullFederateAmbassador::~NullFederateAmbassador(void)" (__imp_??1NullFederateAmbassador@rti1516e@@UEAA@XZ) referenced in function "public: virtual __cdecl NullFederateAmbassadorChild::~NullFederateAmbassadorChild(void)" (??1NullFederateAmbassadorChild@@UEAA@XZ)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::announceSynchronizationPoint(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,class rti1516e::VariableLengthData const &)" (?announceSynchronizationPoint@NullFederateAmbassador@rti1516e@@UEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBVVariableLengthData@2@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::attributeIsNotOwned(class rti1516e::ObjectInstanceHandle,class rti1516e::AttributeHandle)" (?attributeIsNotOwned@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@VAttributeHandle@2@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::attributeIsOwnedByRTI(class rti1516e::ObjectInstanceHandle,class rti1516e::AttributeHandle)" (?attributeIsOwnedByRTI@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@VAttributeHandle@2@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::attributeOwnershipAcquisitionNotification(class rti1516e::ObjectInstanceHandle,class std::set<class rti1516e::AttributeHandle,struct std::less<class rti1516e::AttributeHandle>,class std::allocator<class rti1516e::AttributeHandle> > const &,class rti1516e::VariableLengthData const &)" (?attributeOwnershipAcquisitionNotification@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@AEBV?$set@VAttributeHandle@rti1516e@@U?$less@VAttributeHandle@rti1516e@@@std@@V?$allocator@VAttributeHandle@rti1516e@@@4@@std@@AEBVVariableLengthData@2@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::attributeOwnershipUnavailable(class rti1516e::ObjectInstanceHandle,class std::set<class rti1516e::AttributeHandle,struct std::less<class rti1516e::AttributeHandle>,class std::allocator<class rti1516e::AttributeHandle> > const &)" (?attributeOwnershipUnavailable@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@AEBV?$set@VAttributeHandle@rti1516e@@U?$less@VAttributeHandle@rti1516e@@@std@@V?$allocator@VAttributeHandle@rti1516e@@@4@@std@@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::attributesInScope(class rti1516e::ObjectInstanceHandle,class std::set<class rti1516e::AttributeHandle,struct std::less<class rti1516e::AttributeHandle>,class std::allocator<class rti1516e::AttributeHandle> > const &)" (?attributesInScope@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@AEBV?$set@VAttributeHandle@rti1516e@@U?$less@VAttributeHandle@rti1516e@@@std@@V?$allocator@VAttributeHandle@rti1516e@@@4@@std@@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::attributesOutOfScope(class rti1516e::ObjectInstanceHandle,class std::set<class rti1516e::AttributeHandle,struct std::less<class rti1516e::AttributeHandle>,class std::allocator<class rti1516e::AttributeHandle> > const &)" (?attributesOutOfScope@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@AEBV?$set@VAttributeHandle@rti1516e@@U?$less@VAttributeHandle@rti1516e@@@std@@V?$allocator@VAttributeHandle@rti1516e@@@4@@std@@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::confirmAttributeOwnershipAcquisitionCancellation(class rti1516e::ObjectInstanceHandle,class std::set<class rti1516e::AttributeHandle,struct std::less<class rti1516e::AttributeHandle>,class std::allocator<class rti1516e::AttributeHandle> > const &)" (?confirmAttributeOwnershipAcquisitionCancellation@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@AEBV?$set@VAttributeHandle@rti1516e@@U?$less@VAttributeHandle@rti1516e@@@std@@V?$allocator@VAttributeHandle@rti1516e@@@4@@std@@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::confirmAttributeTransportationTypeChange(class rti1516e::ObjectInstanceHandle,class std::set<class rti1516e::AttributeHandle,struct std::less<class rti1516e::AttributeHandle>,class std::allocator<class rti1516e::AttributeHandle> >,enum rti1516e::TransportationType)" (?confirmAttributeTransportationTypeChange@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@V?$set@VAttributeHandle@rti1516e@@U?$less@VAttributeHandle@rti1516e@@@std@@V?$allocator@VAttributeHandle@rti1516e@@@4@@std@@W4TransportationType@2@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::confirmInteractionTransportationTypeChange(class rti1516e::InteractionClassHandle,enum rti1516e::TransportationType)" (?confirmInteractionTransportationTypeChange@NullFederateAmbassador@rti1516e@@UEAAXVInteractionClassHandle@2@W4TransportationType@2@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::connectionLost(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (?connectionLost@NullFederateAmbassador@rti1516e@@UEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::discoverObjectInstance(class rti1516e::ObjectInstanceHandle,class rti1516e::ObjectClassHandle,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (?discoverObjectInstance@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@VObjectClassHandle@2@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::discoverObjectInstance(class rti1516e::ObjectInstanceHandle,class rti1516e::ObjectClassHandle,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,class rti1516e::FederateHandle)" (?discoverObjectInstance@NullFederateAmbassador@rti1516e@@UEAAXVObjectInstanceHandle@2@VObjectClassHandle@2@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@VFederateHandle@2@@Z)
1>CBRTILibrary.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl rti1516e::NullFederateAmbassador::federationNotRestored(enum rti1516e::RestoreFailureReason)" (?federationNotRestored@NullFederateAmbassador@rti1516e@@UEAAXW4RestoreFailureReason@2@@Z)
1>mainRti.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl  . . . . . . . . etc

1>C:\Dev\x64\Debug\myRTI.dll : fatal error LNK1120: 62 unresolved externals
1

There are 1 answers

0
Yserbius On

IEEE HLA 1516-2010 (AKA HLA 1516 Evolved) is just a definition of an API. It's up to the developers to create an RTI that has actual functionality. There are several commercial RTIs out there along with a handful of FOSS. I know that Pitch and MaK sell ones that implement 1516-2010. The most popular Open Source implementation is Portico (https://porticoproject.org/).

Once you have an RTI (or write your own, if you so choose), you need to compile the federate and link it to the libraries provided by the RTI.