I'm on Ubuntu 13.04 trying to use functions from the gsettingsschema.h library
This is my .pro file
QT+=core
QT-=gui
TARGET=gsettings_test
CONFIG+=console
CONFIG-=app_bundle
CONFIG+=link_pkgconfig
PKGCONFIG+=gio-2.0
TEMPLATE=app
SOURCES+=main.cpp
pkg-config --libs gio-2.0 reports :
-lgio-2.0 -lgobject-2.0 -lglib-2.0
which sounds good to me.
In my program I use both the gio/gio.h and gio/gsettingsschema.h libraries. The compiler is able to find the functions from gio.h (like g_settings_new_full()) but it is not able to find the functions from gsettingsschema.h
I get an error like:
undefined reference to 'g_settings_schema_source_get_default()'
What's happening here?
EDIT: Full compilation output (as reported from Qt Creator):
01:46:09: Running steps for project gsettings_test...
01:46:09: Starting: "/usr/bin/qmake" /home/alex/Qt/gsettings_test/gsettings_test.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
01:46:09: The process "/usr/bin/qmake" exited normally.
01:46:09: Starting: "/usr/bin/make"
g++ -o gsettings_test main.o -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lQt5Core -lpthread
main.o: In function `gsettings_get(QString, QString)':
/home/alex/Qt/build-gsettings_test-Desktop-Debug/../gsettings_test/main.cpp:17: undefined reference to `g_settings_schema_source_get_default()'
/home/alex/Qt/build-gsettings_test-Desktop-Debug/../gsettings_test/main.cpp:17: undefined reference to `g_settings_schema_source_ref(_GSettingsSchemaSource*)'
/home/alex/Qt/build-gsettings_test-Desktop-Debug/../gsettings_test/main.cpp:19: undefined reference to `g_settings_schema_source_lookup(_GSettingsSchemaSource*, char const*, int)'
collect2: error: ld returned 1 exit status
make: *** [gsettings_test] Error 1
01:46:10: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project gsettings_test (kit: Desktop)
When executing step 'Make'
01:46:10: Elapsed time: 00:01.
Libgio exact filename:
/usr/lib/i386-linux-gnu/libgio-2.0.so.0.3600.0
Helpful command:
alex@MaD-pc:~$ sudo ldconfig -v | grep gio
[sudo] password for alex:
/sbin/ldconfig.real: Can't stat /lib/i686-linux-gnu: No such file or directory
/sbin/ldconfig.real: Can't stat /usr/lib/i686-linux-gnu: No such file or directory
/sbin/ldconfig.real: Path `/lib/i386-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/i386-linux-gnu' given more than once
libgiomm-2.4.so.1 -> libgiomm-2.4.so.1.3.0
libgio-2.0.so.0 -> libgio-2.0.so.0.3600.0