I'm attempting to implement an extension of an abstract class, as a concrete class; but can't figure out why it's continually compiling to abstract. I think I'm missing a pure virtual somewhere, but can't find it.
I'm building an extension onto the Godot Game Engine, and while my code is compiling, it's telling me time and again that the class I built is abstract. I don't intend for it to be abstract, and I believe I've implemented all of the pure virtuals; but I'm clearly wrong about that or I would have something concrete, wouldn't I?
The compilation chain is complex enough to limit me to picking through source code and trying to find = 0;
code that I haven't touched; I don't seem to have reasonable access to simply adding a main function and attempting to instance the class, because I'm building an so
and a dll
. I tried adding a main to squeeze out a detailed error message, and just building with gcc
, but the -I
for it is apparently all over the place, and it's usually managed by SCons.
I can't help but think that there must be an easier way to find out than this. The Godot editor hasn't been especially helpful, and while there's a very popular action item for it, it isn't yet possible to extend an abstract class with the internal GDScript and backtrace it to C++ from there.
I'm using Linux Mint and have access to objdump
and nm
; nm
hasn't been terribly useful but I'm open to suggestions with either. I believe that SCons is using gcc
, not clang
, but am not entirely sure.
Here's my header:
#ifndef NULLARY_MULTIPLAYER_PEER
#define NULLARY_MULTIPLAYER_PEER
#include <godot_cpp/classes/multiplayer_peer.hpp>
#include <godot_cpp/classes/crypto.hpp>
namespace godot {
class NullaryMultiplayerPeer : public MultiplayerPeer {
GDCLASS(NullaryMultiplayerPeer, MultiplayerPeer);
private:
protected:
static void _bind_methods();
public:
NullaryMultiplayerPeer();
~NullaryMultiplayerPeer();
void set_transfer_channel(int p_channel);
int get_transfer_channel() const;
void set_transfer_mode(TransferMode p_mode);
TransferMode get_transfer_mode() const;
void set_refuse_new_connections(bool p_enable);
bool is_refusing_new_connections() const;
bool is_server_relay_supported() const;
void set_target_peer(int p_peer_id);
int get_packet_peer() const;
TransferMode get_packet_mode() const;
int get_packet_channel() const;
void disconnect_peer(int p_peer, bool p_force = false);
bool is_server() const;
void poll();
void close();
int get_unique_id() const;
ConnectionStatus get_connection_status() const;
};
}
#endif
And here's my CPP:
#include "nullary_multiplayer_peer.h"
#include <godot_cpp/core/class_db.hpp>
using namespace godot;
void NullaryMultiplayerPeer::_bind_methods() {
}
NullaryMultiplayerPeer::NullaryMultiplayerPeer() {
}
NullaryMultiplayerPeer::~NullaryMultiplayerPeer() {
}
void NullaryMultiplayerPeer::set_transfer_channel(int p_channel) {}
int NullaryMultiplayerPeer::get_transfer_channel() const { return 0; }
void NullaryMultiplayerPeer::set_transfer_mode(TransferMode p_mode) {}
MultiplayerPeer::TransferMode NullaryMultiplayerPeer::get_transfer_mode() const { return MultiplayerPeer::TransferMode::TRANSFER_MODE_UNRELIABLE; }
void NullaryMultiplayerPeer::set_refuse_new_connections(bool p_enable) {}
bool NullaryMultiplayerPeer::is_refusing_new_connections() const { return true; }
bool NullaryMultiplayerPeer::is_server_relay_supported() const { return false; }
void NullaryMultiplayerPeer::set_target_peer(int p_peer_id) { }
int NullaryMultiplayerPeer::get_packet_peer() const { return 0; }
MultiplayerPeer::TransferMode NullaryMultiplayerPeer::get_packet_mode() const { return MultiplayerPeer::TransferMode::TRANSFER_MODE_UNRELIABLE; }
int NullaryMultiplayerPeer::get_packet_channel() const { return 0; }
void NullaryMultiplayerPeer::disconnect_peer(int p_peer, bool p_force) { }
bool NullaryMultiplayerPeer::is_server() const { return false; }
void NullaryMultiplayerPeer::poll() {}
void NullaryMultiplayerPeer::close() {}
int NullaryMultiplayerPeer::get_unique_id() const { return 0; }
MultiplayerPeer::ConnectionStatus NullaryMultiplayerPeer::get_connection_status() const { return MultiplayerPeer::ConnectionStatus::CONNECTION_DISCONNECTED; }
It's still building to an uninstantiable abstract class. I'm not sure what I'm missing.
Thanks.