且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误:无效值不应该被忽略-C/GTK +

更新时间:2023-11-13 16:25:46

行号对我来说意义不大,但我认为您的问题就在这里(出于说明目的而重新格式化):

The line number doesn't make much sense to me but I think your problem is right here (reformatted for illustrative purposes):

g_signal_connect(G_OBJECT(button), "new_tab",
    G_CALLBACK(new_tab(GTK_NOTEBOOK(notebook), content, hbox)), /* <== Badness */
    NULL
);

您正在G_CALLBACK宏内调用new_tab函数. new_tab函数返回void(即没有返回值),但是在需要一个值的上下文中被调用,因此将出现无效的空值"错误.我想你的意思是说更多这样的话:

You're calling the new_tab function inside the G_CALLBACK macro. The new_tab function returns void (i.e. no return value) but it is being called in a context that needs a value and hence the "void value not ignored" error. I think you mean to say something more like this:

g_signal_connect(G_OBJECT(button), "new_tab", G_CALLBACK(new_tab), NULL);