gpt4 book ai didi

c++ - Gtkmm 'no matching function for call' 错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:22:07 25 4
gpt4 key购买 nike

我是初学者,正在按照官方文档学习 Gtkmm。

但是这个例子: https://developer.gnome.org/gtkmm-tutorial/stable/sec-menus-examples.html.en#menu-example-main

不工作,我收到这些错误:

examplewindow.cc: In constructor ‘ExampleWindow::ExampleWindow()’:
examplewindow.cc:18:67: error: no matching function for call to
‘Gio::SimpleActionGroup::add_action(const char [12],
sigc::bound_mem_functor0<void, ExampleWindow>)’
sigc::mem_fun(*this, &ExampleWindow::on_menu_file_new_generic));
^

上面的错误针对的是这段代码:

refActionGroup->add_action("newstandard",
sigc::mem_fun(*this, &ExampleWindow::on_menu_file_new_generic));

但是“on_menu_file_new_generic”函数确实存在。那么如果回调函数确实存在,那怎么会说“没有匹配的函数”呢?

有什么帮助吗?

最佳答案

这个错误是因为旧版本的 glibmm 库。我当前的glibmm版本是2.37.4,不支持这种方式。

这个重载的 add_action() 方法首次出现在 glibmm 2.37.6 中,所以为了克服这个错误,我需要安装更新版本的 glibmm。

希望其他人也能解决他们的错误。

关于c++ - Gtkmm 'no matching function for call' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24570676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com