unresolved external symbol "__declspec(dllimport)"

  c++, declspec, dll, dllexport

I’m trying to code a little plugin for bakkesmod because I’m pissing myself off.
I watched the only 2 video that exists on this topic but … it doesn’t work and I have this error for each void – >> Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "__declspec(dllimport) public: void __thiscall GameWrapper::HookEvent(class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::function<void __cdecl(class std::basic_string<char,struct std::char_traits,class std::allocator >)>)" (_imp[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@@Z) TagName C:UsersleodusourcereposTagNameTagNameTrollTagName.obj 1

here is my code.

TroolTagName.cpp (not judge the name)

#include "TrollTagName.h"

BAKKESMOD_PLUGIN(TroolTagName, "Trool Tag Name", "1.0", PERMISSION_ALL)

void TroolTagName::onLoad() 
{
    this->Log("This is my first Bakkesmod Plugin");

    this->LoadHooks();
}

void TroolTagName::onUnload() 
{

}

void TroolTagName::LoadHooks() 
{
    gameWrapper->HookEvent("Function TAGame.GameEvent_Soccar_TA.EventMatchEnded", std::bind(&TroolTagName::GameEndedEvent, this, std::placeholders::_1));
    gameWrapper->HookEvent("Function TAGame.AchievementManager_TA.HandleMatchEnded", std::bind(&TroolTagName::GameEndedEvent, this, std::placeholders::_1));
}

void TroolTagName::GameEndedEvent(std::string name) 
{
    cvarManager->executeCommand("load_freeplay");
}

void TroolTagName::Log(std::string msg) 
{
    cvarManager->log("TroolTagName: " + msg);
}

TroolTagName.h


#include "bakkesmodpluginbakkesmodplugin.h"

#pragma comment(lib, "pluginsdk.lib")
class TroolTagName : public BakkesMod::Plugin::BakkesModPlugin
{
public:
    virtual void onLoad();
    virtual void onUnload();

    void LoadHooks();
    void GameEndedEvent(std::string name);

private:
    void Log(std::string msg);
};

The project and a Dynamic-library dll project.

I tried adding __declspec (dllexport) before void but … I got this error – >> redefinition; different linkage and I found nothing for this error so I am blocked 🙁

Source: Windows Questions C++

LEAVE A COMMENT