gpt4 book ai didi

c - iup 程序在 IupOpen(argc, argv) 中崩溃;

转载 作者:行者123 更新时间:2023-11-30 17:09:08 25 4
gpt4 key购买 nike

我尝试在c中使用IUP

我测试了这个例子

#include <stdlib.h>
#include <iup/iup.h>

int main(int argc, char **argv)
{
Ihandle *dlg, *label;
IupOpen(argc, argv);
label = IupLabel("Hello world from IUP.");
dlg = IupDialog(IupVbox(label, NULL));
IupSetAttribute(dlg, "TITLE", "Hello World 2");
IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
IupMainLoop();
IupClose();
return EXIT_SUCCESS;
}

我是这样编译的

gcc q.c -liup -o q

海湾合作委员会给了我这个

q.c: In function â€کmain’:
q.c:6:3: warning: passing argument 1 of â€کIupOpen’ makes pointer from integer without a cast [enabled by default]
IupOpen(argc, argv);
^
In file included from q.c:2:0:
/usr/include/iup/iup.h:35:11: note: expected â€کint *’ but argument is of type â€کint’
int IupOpen (int *argc, char ***argv);
^
q.c:6:3: warning: passing argument 2 of â€کIupOpen’ from incompatible pointer type [enabled by default]
IupOpen(argc, argv);
^
In file included from q.c:2:0:
/usr/include/iup/iup.h:35:11: note: expected â€کchar ***’ but argument is of type â€کchar **’
int IupOpen (int *argc, char ***argv);
^

当我运行该程序时,它崩溃了。然后我使用 gdb 运行它,gdb 告诉我程序在这一行崩溃了:

IupOpen(argc, argv);

我使用了rtfm和stfw,但没有找到解决方案。

最佳答案

您应该调用 IupOpen(&argc, &argv),这就是 gcc 警告您的内容。

关于c - iup 程序在 IupOpen(argc, argv) 中崩溃;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33389512/

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