我在测试基于Motif的小程序时,系统报头文件找不到。
程序如下test.c:
#include
1<xm pushb.h="">
2main (int argc, char *argv[])
3{
4Widget toplevel, button;
5XtAppContext app;
6void button_pushed(Widget, XtPointer, XtPointer);
7XmString label;
8Arg args[2];
9XtSetLanguageProc (NULL, NULL, NULL);
10toplevel = XtVaOpenApplication (&app, "Hello", NULL, 0, &argc, argv,
11NULL,sessionShellWidgetClass, NULL);
12label = XmStringCreateLocalized ("Push here to say hello");
13XtSetArg(args[0], XmNlabelString, label);
14button = XmCreatePushButton (toplevel, "pushme", args, 1);
15XmStringFree (label);
16XtAddCallback (button, XmNactivateCallback, button_pushed, NULL);
17XtManageChild (button);
18XtRealizeWidget (toplevel);
19XtAppMainLoop (app);
20}
21void button_pushed (Widget widget, XtPointer client_data, XtPointer call_data)
22{
23printf ("Hello Yourself!\n");
24}
25
26我的编译命令:
27gcc -W -o test test.c -L/usr/X11R6/lib -lXm -lXt -lX11
28
29报错为:
30Xm/PushB.h:No such file or directory
31
32Xm的目录是个链接,实际情况为:
33/usr/X11R6/include/Xm -> ../LessTif/Motif1.2/include/Xm
34
35\---------------------------------------------------------------
36
37gcc -W -o test test.c -L/usr/X11R6/lib -lXm -lXt -lX11 -I/usr/X11R6/include</xm>