Why can't I declare two functions with similiar names?

I have a function FireEvent, and I’m trying to make a variant with a similar name for when I want to pass different arguments:

virtual void FireEvent(EMorphemeID ID, AActor* instigator);
virtual void FireEvent_OneFloat(EMorphemeID ID, AActor* instigator, float number);

The first line compiles cleanly, but the second line won’t compile, and it gives me the sort of weird errors that make me suspect a linker problem:

Error Module.project.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl UMorpheme::FireEvent_OneFloat(enum EMorphemeID,class AActor *,float)” (?FireEvent_OneInt@UMorpheme@@UEAAXW4EMorphemeID@@PEAVAActor@@anonymous_user_142fbdd5@Z)
Error project.generated.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl UMorpheme::FireEvent_OneFloat(enum EMorphemeID,class AActor *,float)” (?FireEvent_OneInt@UMorpheme@@UEAAXW4EMorphemeID@@PEAVAActor@@anonymous_user_142fbdd5@Z)
fatal error LNK1120: 1 unresolved externals

So what am I doing wrong here? I’ve been scratching my head over this, and I can’t see where the problem would be.

The error means that the linker can’t find the implementation of FireEvent_OneFloat, if you did in fact implement it maybe post the implementation so we could maybe figure out what’s wrong.

I’m a moron, adding an implementation made it work fine. :slight_smile: If you wanna repost as an answer, I’ll mark it right real quick, thank you!!

Ack, my comment got eaten… long story short I’m a moron, this was exactly the problem, and adding the implementation fixed the crash. If you want to add this as an answer, I’ll tick it as correct real quick. :slight_smile:

That works perfectly, thank you! :slight_smile: If you want to make this an answer, I’ll happily accept it.

So you just forgot to write an implementation for it?

Yea, it’s a bad habit I retained from C#- once I added an implementation, even though it was just function(){}, it compiled cleanly.