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



我尝试在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,但我没有找到解决方案。

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

相关内容

  • 没有找到相关文章

最新更新