I have a error using GDNative, "extern symbol "public: __cdecl..."

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CosmoXD

I’m creating a game with C++ and Godot but when i’m building the DLL with Visual Studio 2019 i get this error:

error LNK2019: símbolo externo "public: __cdecl godot::Player::Player(void)" (??0Player@godot@@QEAA@XZ) sin resolver al que se hace referencia en la función "void * __cdecl godot::_godot_class_instance_func<class godot::Player>(void *,void *)" (??$_godot_class_instance_func@VPlayer@godot@@@godot@@YAPEAXPEAX0@Z)

I tried many things for solve this problem but i cannot fix it, Here is all my project files.

Player.h:

    #pragma once
    
    #include <core/Godot.hpp>
    #include <gen/KinematicBody2D.hpp>
    
    using namespace godot;
    
    namespace godot
    {
    	class Player : public KinematicBody2D
    	{
    	private:
    		GODOT_CLASS(Player, KinematicBody2D)
    
    	public:
    		static void _register_methods();
    		void _init();
    		void _process(float delta);
    		Player();
    		~Player();
    	};
    }

Player.cpp:

#include "Player.h"

void Player::_register_methods()
{
	register_method((char*)"_process", &Player::_process);
}

void Player::_init()
{

}

void Player::_process(float delta)
{

}

GodotLibrary.cpp:

#include "Player.h"

using namespace godot;

extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options * o)
{
	Godot::gdnative_init(o);
}

extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options * o)
{
	Godot::gdnative_terminate(o);
}

extern "C" void GDN_EXPORT godot_nativescript_init(void* handle)
{
	Godot::nativescript_init(handle);
	register_class<Player>();
}
:bust_in_silhouette: Reply From: bruvzg

You have constructor and destructor defined in the Player.h but not implemented. Change Player(); and ~Player(); to ~Player() {}; and ~Player() {};