GLib-GIO-ERROR**: No GSettings schemas are install

2019-01-19 16:47发布

问题:

Unfortunately, I am using Windows (Windows7 x64). With MinGW compiler in Code::Blocks and GTK+3.6.4. I compiled manually all the schemas from glib.


When I use File Chooser dialogue / colorpicker - it doesn't matter, I am getting the following error: GLib-GIO-ERROR**: No GSettings schemas are installed on the system and the program terminates.


What do I have to do to fix this?

回答1:

GSettings looks at the compiled schemas in the directories pointed by the $XDG_DATA_DIR environment variable. You can either use a launcher script that sets up the environment for you, or you can rely on the prefix, and install the gschemas.compiled files in the share/glib-2.0/schemas directory under the same prefix as your app binary is, e.g. if you have the following layout:

YourApp/
  bin/
    YourApp.exe
  lib/
    libgtk3.dll
    libgobject.dll
    …
  share/
    …
    glib-2.0/
      schemas/

Make sure that the gschemas.compiled file is under YourApp/share/glib-2.0/schemas, and that the org.gtk.Settings.FileChooser.gschema.xml is there as well.



回答2:

The problem is with the Glib schemas that apparently are not compiled on your system.

You need the glib-compile-schemas and find the glib-2.0/schemas directory which is located in /usr/share/glib-2.0/schemas, I don't know if it will be found in the same path within MinGW, but I don't see why it wouldn't, so you must execute the following command1

glib-compile-schemas /usr/share/glib-2.0/schemas/

and that will create a file gschemas.compiled so you need write permission, then the error will go away.


1Provided that the GLib schemas are installed in that directory.



标签: c gtk mingw gtk3