Reputation: 337
I made a QT Application under Ubuntu 14.04 32bit using QtCreator and QT 5.2.1. I used the binary distribution of QT framework. I followed all the tutorial about deploying QT application and on fresh installation of Ubuntu 14.04 everything seems ok. The problems come with Ubuntu 12.04. When i try to run my app i get those Glib errors.
(process:11884): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()
(process:11884): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed
(process:11884): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()
(process:11884): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()
(process:11884): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()
(process:11884): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
(process:11884): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()
(process:11884): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion `G_TYPE_IS_INTERFACE (interface_type)' failed
(process:11884): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed
(process:11884): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
(process:11884): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()
Can anyone help me to fix these? Thanks
Edit1: The app run with sudo, without the errors, but it doesn't display the icon (libappindicator1)
Upvotes: 1
Views: 1349
Reputation:
The error messages are telling you what the problem is:
GLib-GObject-CRITICAL... You forgot to call g_type_init()
In versions of the GLib library prior to 2.36, applications were required to call a g_type_init
function to initialize the library's GObject type system and apparently your program is not doing this. (Note it could be a library your program builds against that uses GLib, not your actual code.) Presumably Ubuntu 12 ships with an older version of GLib than does Ubuntu 14 and that accounts for the difference in behaviour between them.
Try adding this code to your program right at the start of its main
function:
if (glib_check_version (2, 36, 0) != NULL)
g_type_init ();
You may also need to add this include at the top of the file, if it isn't already present:
#include <glib-object.h>
Note if you're building against a recent version of GLib, having g_type_init
present in your code may trigger a warning from the compiler. If that's a problem, you can add
#define GLIB_DISABLE_DEPRECATION_WARNINGS
at the very top of your code (before the GLib header is included) to prevent this.
Upvotes: 2