我尝试在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而gcc给了我这个
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,但我没有找到解决方案。
发布于 2015-10-28 20:15:28
你应该调用IupOpen(&argc,&argv),这就是gcc警告你的。
https://stackoverflow.com/questions/33389512
复制相似问题