Failed to write a plugin to save video frames

Hi, I am trying to write a plugin which can save video frames locally
here is my code

#include <ctime>
#include <string>
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>

#define PACKAGE "mhelloworldt"

typedef struct _GstMHelloWorldT {
    GstBaseTransform base_transform;
} GstMHelloWorldT;

typedef struct _GstMHelloWorldTClass {
    GstBaseTransformClass base_transform_class;
} GstMHelloWorldTClass;

GType gst_m_hello_world_t_get_type(void);
#define GST_TYPE_M_HELLO_WORLD_T (gst_m_hello_world_t_get_type())
#define GST_M_HELLO_WORLD_T(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_M_HELLO_WORLD_T, GstMHelloWorldT))
#define GST_M_HELLO_WORLD_T_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_M_HELLO_WORLD_T, GstMHelloWorldTClass))

static GstFlowReturn gst_m_hello_world_t_transform_ip(GstBaseTransform *trans, GstBuffer *buf);
static void gst_m_hello_world_t_class_init(GstMHelloWorldTClass *klass);
static void gst_m_hello_world_t_init(GstMHelloWorldT *mhelloworldt);

G_DEFINE_TYPE(GstMHelloWorldT, gst_m_hello_world_t, GST_TYPE_BASE_TRANSFORM)

static void gst_m_hello_world_t_class_init(GstMHelloWorldTClass *klass) {
    GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS(klass);
    base_transform_class->transform_ip = gst_m_hello_world_t_transform_ip;
}

static void gst_m_hello_world_t_init(GstMHelloWorldT *mhelloworldt) {
    // Initialization code here (if needed)
}

static GstFlowReturn gst_m_hello_world_t_transform_ip(GstBaseTransform *trans, GstBuffer *buf) {
    GstMHelloWorldT *mhelloworldt = GST_M_HELLO_WORLD_T(trans);
    GST_DEBUG_OBJECT(mhelloworldt, "transform_ip");

    GstMapInfo map;
    if (!gst_buffer_map(buf, &map, GST_MAP_READ))
        return GST_FLOW_OK;
    
    
    std::time_t t = std::time(0);
    std::string filename = "saved_frames/frame__" + std::to_string(t) + ".jpg";

    FILE *f = fopen(filename.c_str(), "wb");
    if (f) {
        fwrite(map.data, 1, 1, f);
        fclose(f);
    }
    
    gst_buffer_unmap(buf, &map);
    return GST_FLOW_OK;
}

static gboolean plugin_init(GstPlugin *plugin) {
    return gst_element_register(plugin, "mhelloworldt", GST_RANK_NONE, GST_TYPE_M_HELLO_WORLD_T);
}

GST_PLUGIN_DEFINE(
    GST_VERSION_MAJOR,
    GST_VERSION_MINOR,
    mhelloworldt,
    "A Hello World Transform Plugin that processes video frames and saves them as images",
    plugin_init,
    "1.0",
    "LGPL",
    "GStreamer",
    "http://gstreamer.freedesktop.org/"
)

my code compiles by running command below:
sudo g++ -o libmhelloworldt.so -shared -fPIC $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-base-1.0) mhelloworldt.cpp
but I’ve got error by inspecting gst-instpect-1.0 mhelloworldt
which is
Failed to load plugin ..../libmhelloworldt.so: undefined symbol: gst_base_transform_get_type
can anyone help me out?