對‘Glib::XXX’未定義的引用
阿新 • • 發佈:2021-07-09
在編譯easystroke的時候出現了很多未定義的引用錯誤,最終導致編譯失敗
g++ -o easystroke main.o handler.o composite.o shape.o win.o gesture.o stats.o actiondb.o prefdb.o actions.o prefs.o annotate.o grabber.o water.o fire.o stroke.o cellrenderertextish.o gui.o desktop.o version.o -lboost_serialization -lX11 -lXext -lXi -lXfixes -lXtst `pkg-config gtkmm-3.0dbus-glib-1 --libs` main.o:在函式‘SendText::run()’中: main.cc:(.text+0x2361):對‘Glib::ustring::begin()’未定義的引用 main.cc:(.text+0x238d):對‘Glib::ustring::end()’未定義的引用 main.cc:(.text+0x239d):對‘Glib::get_unichar_from_std_iterator(__gnu_cxx::__normal_iterator<char const*, std::string>)’未定義的引用 main.cc:(.text+0x23b1):對‘Glib::get_unichar_from_std_iterator(__gnu_cxx::__normal_iterator<char const*, std::string>)’未定義的引用 win.o:在函式‘Stroke::draw(Cairo::RefPtr<Cairo::Surface>, int, int, int, int, double, bool) const’中: win.cc:(.text+0xc2c):對‘Cairo::Context::get_text_extents(std::string const&, cairo_text_extents_t&) const’未定義的引用 win.cc:(.text+0xcf3):對‘Cairo::Context::show_text(std::string const&)’未定義的引用 win.o:在函式‘Stroke::draw_svg(std::string) const’中: win.cc:(.text+0x1949):對‘Cairo::SvgSurface::create(std::string, double, double)’未定義的引用 stats.o:在函式‘Stats::on_stroke(boost::shared_ptr<Ranking>)’中: stats.cc:(.text+0xab9):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 stats.cc:(.text+0xcdd):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 stats.o:在函式‘Stats::on_pdf()’中: stats.cc:(.text+0x12db):對‘Cairo::PdfSurface::create(std::string, double, double)’未定義的引用 stats.cc:(.text+0x16ed):對‘Cairo::Context::get_text_extents(std::string const&, cairo_text_extents_t&) const’未定義的引用 stats.cc:(.text+0x1776):對‘Cairo::Context::show_text(std::string const&)’未定義的引用 stats.o:在函式‘Ranking::show(boost::shared_ptr<Ranking>)’中: stats.cc:(.text+0x3051):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 actiondb.o:在函式‘Command::get_label() const’中: actiondb.cc:(.text._ZNK7Command9get_labelEv[_ZNK7Command9get_labelEv]+0x9):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 actiondb.o:在函式‘boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::vsave(boost::archive::class_name_type const&)’中: actiondb.cc:(.text._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEE5vsaveERKNS0_15class_name_typeE[_ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEE5vsaveERKNS0_15class_name_typeE]+0x2b):對‘boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::string const&)’未定義的引用 actiondb.o:在函式‘Glib::ustring Glib::ustring::format<std::string>(std::string const&)’中: actiondb.cc:(.text._ZN4Glib7ustring6formatISsEES0_RKT_[_ZN4Glib7ustring6formatISsEES0_RKT_]+0x20):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 actiondb.o:在函式‘boost::archive::detail::oserializer<boost::archive::text_oarchive, Command>::save_object_data(boost::archive::detail::basic_oarchive&, void const*) const’中: actiondb.cc:(.text._ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveE7CommandE16save_object_dataERNS1_14basic_oarchiveEPKv[_ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveE7CommandE16save_object_dataERNS1_14basic_oarchiveEPKv]+0x5c):對‘boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::string const&)’未定義的引用 actiondb.o:在函式‘boost::archive::detail::iserializer<boost::archive::text_iarchive, Command>::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const’中: actiondb.cc:(.text._ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE7CommandE16load_object_dataERNS1_14basic_iarchiveEPvj[_ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE7CommandE16load_object_dataERNS1_14basic_iarchiveEPvj]+0x4b):對‘boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::string&)’未定義的引用 actiondb.o:在函式‘boost::archive::detail::iserializer<boost::archive::text_iarchive, SendText>::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const’中: actiondb.cc:(.text._ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE8SendTextE16load_object_dataERNS1_14basic_iarchiveEPvj[_ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE8SendTextE16load_object_dataERNS1_14basic_iarchiveEPvj]+0x4f):對‘boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::string&)’未定義的引用 actiondb.cc:(.text._ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE8SendTextE16load_object_dataERNS1_14basic_iarchiveEPvj[_ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE8SendTextE16load_object_dataERNS1_14basic_iarchiveEPvj]+0x5d):對‘Glib::ustring::operator=(std::string const&)’未定義的引用 actiondb.o:在函式‘boost::archive::detail::oserializer<boost::archive::text_oarchive, SendText>::save_object_data(boost::archive::detail::basic_oarchive&, void const*) const’中: actiondb.cc:(.text._ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveE8SendTextE16save_object_dataERNS1_14basic_oarchiveEPKv[_ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveE8SendTextE16save_object_dataERNS1_14basic_oarchiveEPKv]+0x6d):對‘boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::string const&)’未定義的引用 actiondb.o:在函式‘boost::archive::detail::iserializer<boost::archive::text_iarchive, ActionListDiff>::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const’中: actiondb.cc:(.text._ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE14ActionListDiffE16load_object_dataERNS1_14basic_iarchiveEPvj[_ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE14ActionListDiffE16load_object_dataERNS1_14basic_iarchiveEPvj]+0xb1):對‘boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::string&)’未定義的引用 actiondb.o:在函式‘void ActionListDiff::serialize<boost::archive::text_oarchive>(boost::archive::text_oarchive&, unsigned int)’中: actiondb.cc:(.text._ZN14ActionListDiff9serializeIN5boost7archive13text_oarchiveEEEvRT_j[_ZN14ActionListDiff9serializeIN5boost7archive13text_oarchiveEEEvRT_j]+0x9c):對‘boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::string const&)’未定義的引用 actiondb.o:在函式‘boost::archive::detail::iserializer<boost::archive::text_iarchive, std::pair<std::string const, StrokeInfo> >::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const’中: actiondb.cc:(.text._ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveESt4pairIKSs10StrokeInfoEE16load_object_dataERNS1_14basic_iarchiveEPvj[_ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveESt4pairIKSs10StrokeInfoEE16load_object_dataERNS1_14basic_iarchiveEPvj]+0x34):對‘boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::string&)’未定義的引用 actiondb.o:在函式‘boost::archive::detail::iserializer<boost::archive::text_iarchive, StrokeInfo>::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const’中: actiondb.cc:(.text._ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE10StrokeInfoE16load_object_dataERNS1_14basic_iarchiveEPvj[_ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveE10StrokeInfoE16load_object_dataERNS1_14basic_iarchiveEPvj]+0x92):對‘boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::string&)’未定義的引用 actiondb.o:在函式‘boost::archive::detail::oserializer<boost::archive::text_oarchive, StrokeInfo>::save_object_data(boost::archive::detail::basic_oarchive&, void const*) const’中: actiondb.cc:(.text._ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveE10StrokeInfoE16save_object_dataERNS1_14basic_oarchiveEPKv[_ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveE10StrokeInfoE16save_object_dataERNS1_14basic_oarchiveEPKv]+0x92):對‘boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::string const&)’未定義的引用 prefdb.o:在函式‘boost::archive::detail::oserializer<boost::archive::text_oarchive, std::pair<std::string const, TimeoutType> >::save_object_data(boost::archive::detail::basic_oarchive&, void const*) const’中: prefdb.cc:(.text._ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveESt4pairIKSs11TimeoutTypeEE16save_object_dataERNS1_14basic_oarchiveEPKv[_ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveESt4pairIKSs11TimeoutTypeEE16save_object_dataERNS1_14basic_oarchiveEPKv]+0x59):對‘boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::string const&)’未定義的引用 prefdb.o:在函式‘boost::archive::detail::oserializer<boost::archive::text_oarchive, std::set<std::string, std::less<std::string>, std::allocator<std::string> > >::save_object_data(boost::archive::detail::basic_oarchive&, void const*) const’中: prefdb.cc:(.text._ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveESt3setISsSt4lessISsESaISsEEE16save_object_dataERNS1_14basic_oarchiveEPKv[_ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveESt3setISsSt4lessISsESaISsEEE16save_object_dataERNS1_14basic_oarchiveEPKv]+0xde):對‘boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::string const&)’未定義的引用 prefdb.o:在函式‘boost::archive::detail::iserializer<boost::archive::text_iarchive, std::pair<std::string const, TimeoutType> >::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const’中: prefdb.cc:(.text._ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveESt4pairIKSs11TimeoutTypeEE16load_object_dataERNS1_14basic_iarchiveEPvj[_ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveESt4pairIKSs11TimeoutTypeEE16load_object_dataERNS1_14basic_iarchiveEPvj]+0x46):對‘boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::string&)’未定義的引用 prefdb.o:在函式‘void boost::serialization::load_set_collection<boost::archive::text_iarchive, std::set<std::string, std::less<std::string>, std::allocator<std::string> > >(boost::archive::text_iarchive&, std::set<std::string, std::less<std::string>, std::allocator<std::string> >&)’中: prefdb.cc:(.text._ZN5boost13serialization19load_set_collectionINS_7archive13text_iarchiveESt3setISsSt4lessISsESaISsEEEEvRT_RT0_[_ZN5boost13serialization19load_set_collectionINS_7archive13text_iarchiveESt3setISsSt4lessISsESaISsEEEEvRT_RT0_]+0x13c):對‘boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::string&)’未定義的引用 prefdb.o:在函式‘boost::archive::detail::iserializer<boost::archive::text_iarchive, std::pair<std::string const, boost::shared_ptr<ButtonInfo> > >::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const’中: prefdb.cc:(.text._ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveESt4pairIKSsNS_10shared_ptrI10ButtonInfoEEEE16load_object_dataERNS1_14basic_iarchiveEPvj[_ZNK5boost7archive6detail11iserializerINS0_13text_iarchiveESt4pairIKSsNS_10shared_ptrI10ButtonInfoEEEE16load_object_dataERNS1_14basic_iarchiveEPvj]+0x34):對‘boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::string&)’未定義的引用 prefdb.o:在函式‘boost::archive::detail::oserializer<boost::archive::text_oarchive, std::pair<std::string const, boost::shared_ptr<ButtonInfo> > >::save_object_data(boost::archive::detail::basic_oarchive&, void const*) const’中: prefdb.cc:(.text._ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveESt4pairIKSsNS_10shared_ptrI10ButtonInfoEEEE16save_object_dataERNS1_14basic_oarchiveEPKv[_ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveESt4pairIKSsNS_10shared_ptrI10ButtonInfoEEEE16save_object_dataERNS1_14basic_oarchiveEPKv]+0x4b):對‘boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::string const&)’未定義的引用 actions.o:在函式‘Actions::on_remove_app()’中: actions.cc:(.text+0x70c):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 actions.o:在函式‘Actions::load_app_list(Gtk::TreeNodeChildren const&, ActionListDiff*)’中: actions.cc:(.text+0x15d9):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 actions.o:在函式‘Actions::update_row(Gtk::TreeRow const&)’中: actions.cc:(.text+0x29b9):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 actions.o:在函式‘Actions::on_add_app()’中: actions.cc:(.text+0xa21a):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 prefs.o:在函式‘Prefs::on_add()’中: prefs.cc:(.text+0x1c9d):對‘Glib::ustring::ustring(std::string const&)’未定義的引用 prefs.o:prefs.cc:(.text+0x2d37): 跟著更多未定義的參考到 Glib::ustring::ustring(std::string const&) prefs.o:在函式‘Prefs::on_remove()’中: prefs.cc:(.text+0x6758):對‘Glib::ustring::ustring(std::string&&)’未定義的引用 prefs.o:在函式‘void Gtk::TreeRow::set_value<std::string>(Gtk::TreeModelColumn<std::string> const&, std::string const&) const’中: prefs.cc:(.text._ZNK3Gtk7TreeRow9set_valueISsEEvRKNS_15TreeModelColumnIT_EERKS3_[_ZNK3Gtk7TreeRow9set_valueISsEEvRKNS_15TreeModelColumnIT_EERKS3_]+0x2b):對‘Glib::Value<std::string>::set(std::string const&)’未定義的引用 collect2: error: ld returned 1 exit status Makefile:65: recipe for target 'easystroke' failed make: *** [easystroke] Error 1
嘗試了以下方法:
1.一開始以為是glib的問題,嘗試了下面文章中的方法
http://www.hongyanliren.com/2014m06/8405.html
在/usr/include中看到了dbus-1.0和glib-2.0資料夾
以為是dbus-glib-1版本的問題,所以嘗試修改
修改成"dbus-glib-2"和"dbus-1 glib-2",都不行,發現變成了別的錯誤,並且提示在XXXwas not found in the pkg-config search path
2.解除安裝libdbus-glib-1-dev後重裝,不行
然後查看了一下pkg-config中的確包含dbus-glib-1
參考了https://github.com/Beep6581/RawTherapee/issues/3024,只看懂一點點,大致意思是版本不對,之前也嘗試過修改g++版本為7.5.0,原來是4.8.5,但是也沒用,最後把gcc和g++都修改成了7.5.0,重新編譯,成功了