1

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
  • Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) –  Jun 17 '21 at 21:49
  • @Frank This is a public API that should work out the box afaik. The tutorial for using the API says to just subclass "NullFederateAmbassador" and override whatever you want. – Aaron Michael Frost Jun 18 '21 at 16:42
  • The issue is most likely that you have not actually added the API's libraries to your project, but there's a few other things that can lead to that error. The Q/A I linked, especially the accepted answer, should give you all the details you need. –  Jun 18 '21 at 16:48
  • @Frank My IntelliSense works, and I have the include directories setup for the API (which is just a collection of .h files, no .lib or .dll files). – Aaron Michael Frost Jun 18 '21 at 20:35
  • 3
    Oh I see what's going on. Those headers are a *specification* for a library. You still need to provide an implementation to go alongside it. A quick google search for "rti1516e open source implementation" will give you some publically available alternatives for that. –  Jun 18 '21 at 20:37
  • Gosh thanks. I'm pretty new to this. So after I import someone else's implementation, those virtual functions (whose implementations are currently missing) will be automatically bound to the implementations? In other words, I just need to have the .dll or source code of the implementation in the same project for it to link to the function overrides? – Aaron Michael Frost Jun 18 '21 at 21:06
  • You've got the gist of it, but details may vary from one implementation to the other. –  Jun 18 '21 at 21:14

1 Answers1

2

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.

Yserbius
  • 1,375
  • 12
  • 18