How to use relative path in library GTK+ gtk_builder_add_from_file (builder, "example.xml", NULL); ?
Hi everyone,
if i use relative path won`t working to me:
gtk_builder_add_from_file (builder, "builder.xml", NULL);
Error output:
(example3_1:5680): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(example3_1:5680): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(example3_1:5680): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(example3_1:5680): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(example3_1:5680): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(example3_1:5680): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(example3_1:5680): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(example3_1:5680): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
But i use absolute path work to me:
gtk_builder_add_from_file (builder, "/root/CLionProjects/example3.1/builder.xml", NULL);
My CMakeLists.txt
cmake_minimum_required(VERSION 3.9)
project(example3_1 C)
set(CMAKE_C_STANDARD 99)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
add_definitions(${GTK3_CFLAGS_OTHER})
add_executable(example3_1 main.c)
target_link_libraries(example3_1 ${GTK3_LIBRARIES})
Please sign in to leave a comment.
have you found any solution for this?
(sory for the necrobump)
Hi Joaquimadeira!
The relative path is usually relative to the executable. You can try putting your *.xml file right next to the executable and check if it works.
Thanks! i copied the xml file to cmake-build-debug and it works. I thought that somehow the xml definitions were being encoded into the executable...
Again, thanks!