Source codes c++ gtkmm3 gtk4 linux:
#include <gtkmm.h>
#include <gtk/gtk.h>
#include <glib.h>
int main(int argc, char *argv[])
{
auto app =
Gtk::Application::create(argc, argv,
"org.gtkmm.examples.base");
Gtk::Window window;
window.set_default_size(200, 200);
return app->run(window);
}
I compiled them with next command in terminal:
g++ -o main main.cpp $(pkg-config --cflags gtkmm-3.0 --libs gtk3)
and they does not start and I see next errors in console (terminal) on xubuntu 21.10 xfce (xfce4-panel 4.16.3 (Xfce 4.16))
user#myPC:~$ ./main
(process:39732): GLib-GObject-WARNING **: 18:55:52.593: cannot register existing type 'GtkWidget'
(process:39732): GLib-GObject-WARNING **: 18:55:52.593: cannot add class private field to invalid type '<invalid>'
(process:39732): GLib-GObject-WARNING **: 18:55:52.593: cannot add private field to invalid (non-instantiatable) type '<invalid>'
(process:39732): GLib-GObject-CRITICAL **: 18:55:52.593: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
(process:39732): GLib-GObject-WARNING **: 18:55:52.593: cannot register existing type 'GtkBuildable'
(process:39732): GLib-GObject-CRITICAL **: 18:55:52.593: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed
(process:39732): GLib-CRITICAL **: 18:55:52.593: g_once_init_leave: assertion 'result != 0' failed
(process:39732): GLib-GObject-CRITICAL **: 18:55:52.593: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
(process:39732): GLib-GObject-CRITICAL **: 18:55:52.593: g_type_register_static: assertion 'parent_type > 0' failed
(process:39732): GLib-GObject-WARNING **: 18:55:52.593: cannot add private field to invalid (non-instantiatable) type '<invalid>'
(process:39732): GLib-CRITICAL **: 18:55:52.593: g_once_init_leave: assertion 'result != 0' failed
(process:39732): GLib-GObject-CRITICAL **: 18:55:52.593: g_type_register_static: assertion 'parent_type > 0' failed
(process:39732): GLib-GObject-WARNING **: 18:55:52.593: cannot add private field to invalid (non-instantiatable) type '<invalid>'
Why?
I think you may need the package gtk3-engines-xfce or later to be installed.
sudo apt update
sudo apt install gtk3-engines-xfce
I don't known the reason of it. I use gtkmm on mac os and I noticed I must use "g++ -std=c++11 to compile the source, or it will failed.
for your code, I think you just include <gtkmm.h> to get the program work. gtk.h and glib.h shoule be included by gtkmm.h already.
Related
I'm running GStreamer in Raspbian Buster and I get a bunch of warnings the first time I use it, after a fresh install. This is not very problematic because is only one. However, I want to create a python binary using pyinstaller and each time I run the executable, I get the same warings. Any idea what is causing all these warnings? And how can I remove then, when using gst-python?
(hello_world:14518): GStreamer-WARNING **: 00:20:12.375: Failed to load plugin '/tmp/_MEIwrkn0j/libmmal_core.so': /tmp/_MEIwrkn0j/libmmal_vc_client.so: undefined symbol: mmal_status_to_string
(hello_world:14518): GStreamer-WARNING **: 00:20:12.376: Failed to load plugin '/tmp/_MEIwrkn0j/libmmal_util.so': /tmp/_MEIwrkn0j/libmmal_util.so: undefined symbol: mmal_log_category
(hello_world:14518): GStreamer-WARNING **: 00:20:12.386: Failed to load plugin '/tmp/_MEIwrkn0j/libmmal_vc_client.so': /tmp/_MEIwrkn0j/libmmal_vc_client.so: undefined symbol: mmal_log_category
(hello_world:14518): GStreamer-WARNING **: 00:20:12.399: Failed to load plugin '/tmp/_MEIwrkn0j/gst_plugins/libgstopenal.so': /tmp/_MEIwrkn0j/gst_plugins/libgstopenal.so: undefined symbol: _gst_debug_min
(hello_world:14518): GStreamer-WARNING **: 00:20:12.401: Failed to load plugin '/tmp/_MEIwrkn0j/gst_plugins/libgstmpeg2enc.so': /tmp/_MEIwrkn0j/gst_plugins/libgstmpeg2enc.so: undefined symbol: GST_CAT_DEFAULT
(hello_world:14518): GStreamer-WARNING **: 00:20:12.404: Failed to load plugin '/tmp/_MEIwrkn0j/gst_plugins/libgstlame.so': /tmp/_MEIwrkn0j/gst_plugins/libgstlame.so: undefined symbol: _gst_debug_min
I'm in Ubuntu 20.04 using Opencv 4.4.0 in C++. I can run the file but failure throwing the next message:
[ WARN:0] global /home/user/opencv-4.4.0/modules/videoio/src/cap_gstreamer.cpp (713) open OpenCV | GStreamer warning: Error opening bin: error de sintaxis
[ WARN:0] global /home/user/opencv-4.4.0/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Error opening video stream or file
I don't know what's the problem
I wrote small GTK+ application on C++ that works fine for me on Debian x64 with Gnome 3. However, it doesn't work on Lubuntu x86. So I've written test program that creates window with some widgets from my gui.glade file, and it doesn't work too on Lubuntu, but works on Debian. Here goes test code:
#include <gtk/gtk.h>
void create_window()
{
GtkBuilder *builder;
builder = gtk_builder_new();
gtk_builder_add_from_file (builder, "src/gui.glade", NULL);
gtk_builder_connect_signals (builder, NULL);
GtkWidget *window;
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_title (GTK_WINDOW (window), "Startup Settings");
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (window);
}
int main (int argc, char *argv[])
{
gtk_init (&argc, &argv);
create_window();
gtk_main ();
}
I compile it with g++:
g++ -std=c++11 `pkg-config --cflags gtk+-3.0` test.cpp -rdynamic `pkg-config --libs gtk+-3.0`
Error output:
** (a.out:17864): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
(a.out:17864): Gtk-CRITICAL **: gtk_window_set_title: assertion 'GTK_IS_WINDOW (window)' failed
(a.out:17864): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(a.out:17864): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(a.out:17864): Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' faile
You can download gui.glade here.
I've just opened my gui.glade file properties and the problem became obvious. By default Glade requires the latest version of GTK+ installed on your computer. I'm using Debian unstable, so for me it's GTK 3.20. When I tested it on stable system, it didn't work, because there was GTK 3.18 installed on it.
To solve the problem I've changed my gui.glade properties via Glage and decreased required GTK version to 3.10.
When I try to launch my videowidget application it gives me the error:
(videowidget:9305): GLib-GObject-WARNING **: cannot register existing type 'GstObject'
(videowidget:9305): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(videowidget:9305): GLib-GObject-CRITICAL **: g_type_register_static: assertion 'parent_type > 0' failed
(videowidget:9305): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(videowidget:9305): GStreamer-CRITICAL **: gst_element_class_set_details_simple: assertion 'GST_IS_ELEMENT_CLASS (klass)' failed
(videowidget:9305): GStreamer-WARNING **: static caps 0xade3824c string is NULL
(videowidget:9305): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed
(videowidget:9305): GStreamer-WARNING **: static caps 0xade3828c string is NULL
(videowidget:9305): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed
(videowidget:9305): GStreamer-WARNING **: static caps 0xade3824c string is NULL
(videowidget:9305): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed
I have two GStreamer versions installed on my target machine 0.10 and 1.0 which runs on Jessie 8.2.
I figured out that when I uninstall 1.0, 0.10 version requires an .so file from gstreamer1.0.
VideoWidget example from Qt example folder works fine, but the simple example from doc.qt.io/qt-5/videooverview.html won't work.
1.0 and 0.10 are parallel installable and I doubt one is trying to use a file from the other.
Those issues usually happen when the application was linked against both versions. While you can have both at your system, applications should link only against one of them.
when you construct an object ,it's parent should be Q_NULL_POINTER.
QFileDialog *pDlg = new QFileDialog();
instead of
QFileDialog *pDlg = new QFileDialog(this);
It tried to run a GStreamer Tutorial Example, that already worked, but didn't work anymore right now. I didn't change the source code. I build the Project with CMake.
I get the following Error on every of my Testprograms, that are slightly different from each other:
(GStreamer_Test_AppSrc:28073): GLib-GObject-CRITICAL **: g_param_spec_boxed: assertion `G_TYPE_IS_BOXED (boxed_type)' failed
(GStreamer_Test_AppSrc:28073): GLib-GObject-CRITICAL **: g_object_class_install_property: assertion `G_IS_PARAM_SPEC (pspec)' failed
(GStreamer_Test_AppSrc:28073): GLib-GObject-WARNING **: gsignal.c:1644: parameter 1 of type `<invalid>' for signal "GstAppSrc::push_buffer" is not a value type
(GStreamer_Test_AppSrc:28073): GLib-GObject-WARNING **: cannot register existing type `GstObject'
(GStreamer_Test_AppSrc:28073): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed
(GStreamer_Test_AppSrc:28073): GLib-GObject-CRITICAL **: g_type_register_static: assertion `parent_type > 0' failed
(GStreamer_Test_AppSrc:28073): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed
(GStreamer_Test_AppSrc:28073): GStreamer-CRITICAL **: gst_element_class_set_static_metadata: assertion `GST_IS_ELEMENT_CLASS (klass)' failed
(GStreamer_Test_AppSrc:28073): GStreamer-CRITICAL **: gst_caps_ref: assertion `GST_CAPS_REFCOUNT_VALUE (caps) > 0' failed
(GStreamer_Test_AppSrc:28073): GStreamer-CRITICAL **: gst_caps_ref: assertion `GST_CAPS_REFCOUNT_VALUE (caps) > 0' failed
(GStreamer_Test_AppSrc:28073): GStreamer-CRITICAL **: gst_caps_unref: assertion `GST_CAPS_REFCOUNT_VALUE (caps) > 0' failed
The Problem was, that i had installed GStreamer 0.10.x AND 1.x and mixed together both respectively CMake.
CMake remembered some Cache Settings, when i tried to compile my Project with GStreamer 1.x. After cleaning up the Out-of-Source Build Directory of the CMake-Project and rebuilt the Project again with solely GStreamer-0.10.x Dependencies, my Programs again worked as expected.