0

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 を実行しましたが、解決策が見つかりませんでした。

4

1 に答える 1