首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iup程序在IupOpen(argc,argv)中崩溃

iup程序在IupOpen(argc,argv)中崩溃
EN

Stack Overflow用户
提问于 2015-10-28 19:12:54
回答 1查看 74关注 0票数 0

我尝试在c++中使用IUP。

我测试了这个例子

代码语言:javascript
复制
#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;
}

我这样编译它

代码语言:javascript
复制
gcc q.c -liup -o q

而gcc给了我这个

代码语言:javascript
复制
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告诉我程序在一行中崩溃了:

代码语言:javascript
复制
IupOpen(argc, argv);

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

EN

回答 1

Stack Overflow用户

发布于 2015-10-28 20:15:28

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33389512

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档