简体   繁体   中英

Raspberry PI 2 undefined reference to

I have a new RasPi 2, I've installed latest version of Raspbian and all the libraries that I need to compile a project that I'm working on. The libraries were installed from repositories after a "sudo apt-get update" so they should be the latest version.

The compiling of the project works fine, but on linking I get the following errors:

/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgobject-2.0.so: undefined reference to `g_markup_parse_context_ref'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_variant_new_take_string'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgobject-2.0.so: undefined reference to `g_datalist_id_replace_data'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_spawn_check_exit_status'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgtk-3.so: undefined reference to `g_slist_copy_deep'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgobject-2.0.so: undefined reference to `g_unix_signal_funcs'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgobject-2.0.so: undefined reference to `g_variant_dict_unref'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_hash_table_get_keys_as_array'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_variant_dict_end'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_source_query_unix_fd'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgobject-2.0.so: undefined reference to `g_datalist_id_dup_data'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgobject-2.0.so: undefined reference to `g_unix_fd_source_funcs'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_str_tokenize_and_fold'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_variant_new_from_bytes'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_variant_check_format_string'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_list_copy_deep'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_variant_get_data_as_bytes'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgobject-2.0.so: undefined reference to `g_variant_dict_ref'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_source_add_unix_fd'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_close'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_variant_dict_new'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_variant_dict_insert_value'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_option_context_parse_strv'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_unix_fd_source_new'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgtk-3.so: undefined reference to `g_variant_parse_error_quark'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgobject-2.0.so: undefined reference to `g_markup_parse_context_unref'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_source_get_ready_time'
/home/andrei/rpi/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0: undefined reference to `g_source_set_ready_time'

What could be the problem and how can I fix this?

Thank you!

I've got the same error, but the problem was solved by reading libglib-2.0.so.
Because the undefined references shown in your post should be contained in /lib/arm-linux-gnueabihf/libglib-2.0.so, the project must read that library.
It may be a good idea to check the library path or library search path.
Sorry for my poor English.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM