0

i'm trying to build an RTSP server with GStreamer in Visual Studio but i'm encountering some errors.

error LNK2019: unresolved external symbol __imp_gst_rtsp_media_factory_new referenced in function main error LNK2019: unresolved external symbol __imp_gst_rtsp_media_factory_set_launch referenced in function main error LNK2019: unresolved external symbol __imp_gst_rtsp_mount_points_add_factory referenced in function main error LNK2019: unresolved external symbol __imp_gst_rtsp_server_new referenced in function main error LNK2019: unresolved external symbol __imp_gst_rtsp_server_get_mount_points referenced in function main error LNK2019: unresolved external symbol __imp_gst_rtsp_server_attach referenced in function main

And this is the code i'm trying to build

#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>

int main(int argc, char* argv[])
{
    gst_init(&argc, &argv);

    // Create the RTSP server
    GstRTSPServer* server = gst_rtsp_server_new();

    // Get the mount points for the server
    GstRTSPMountPoints* mounts = gst_rtsp_server_get_mount_points(server);

    // Create the RTSP media factory
    GstRTSPMediaFactory* factory = gst_rtsp_media_factory_new();

    // Set the launch string for the media factory
    gst_rtsp_media_factory_set_launch(factory, "uridecodebin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm ! videoconvert ! x264enc ! rtph264pay name=pay0");

    // Mount the factory to the "/test" path
    gst_rtsp_mount_points_add_factory(mounts, "/test", factory);

    // Release the reference to the mounts
    g_object_unref(mounts);

    // Attach the server to a specific port
    int port = 8554; // Choose the desired port number
    gchar* address = "192.168.0.100"; // Set the desired IP address or "0.0.0.0" for any address
    gst_rtsp_server_attach(server, NULL, port, &address);

    // Start the main loop
    GMainLoop* loop = g_main_loop_new(NULL, FALSE);
    g_main_loop_run(loop);

    // Clean up
    g_main_loop_unref(loop);
    gst_object_unref(server);

    return 0;
}

and i followed the steps provided in this question to configure gstreamer in visual studio How do I configure Visual Studio 2017 to run Gstreamer tutorials? and i was able to build and run the tutorials but i still don't know what is missing or how to solve the problem

  • I guess it has nothing to do with the posted code. Most likely you just didn't configure your project correctly to link with gstreamer libraries. Did you read https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix ? – pptaszni Aug 29 '23 at 10:58

1 Answers1

0

According to the link above, gstrtspserver-1.0.lib is not added. You need to add it in Linker->Input.

To run the program, the gstreamer\<version>\msvc_x86_64\bin folder needs to be added to the system environment variable PATH.

Minxin Yu - MSFT
  • 2,234
  • 1
  • 3
  • 14