QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 610|回复: 0

请教一个motif的问题。

[复制链接]
发表于 2003-8-2 12:04:19 | 显示全部楼层 |阅读模式
有如下一段代码,用
gcc -o hellowold hellowld.c -lX11 -lXm -lXt
编译出错误:
/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
我用redhat9,完全安装,相应得库肯定是装了的。
请问是怎么回事?
谢谢


代码如下:
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/XmAll.h>
#include <Xm/Form.h>
#include <Xm/Label.h>
#include <Xm/PushB.h>

void activateCB();
XmString btn_text;

int main(argc,argv)
unsigned int argc;
char **argv;
{
Widget toplevel;
Widget myform;
Widget mylabel;
Widget mybutton;
XtAppContext app_context;
Arg args[10];
int i;
toplevel=XtAppInitialize(&app_context,"Xmdemos",NULL,0,&argc,argv,NULL,NULL,0);

i=0;
XtSetArg(args,XmNwidth,160);i++;
XtSetArg(args,XmNheight,100);i++;
myform=XtCreateManagedWidget("Form",xmFormWidgetClass,toplevel,args,i);

btn_text=XmStringCreateLtoR("Exit",XmSTRING_DEFAULT_CHARSET);
i=0;
XtSetArg(args,XmNlabelString,btn_text);i++;
XtSetArg(args,XmNheight,30);i++;
XtSetArg(args,XmNtopAttachment,XmATTACH_FORM);i++;
XtSetArg(args,XmNleftAttachment,XmATTACH_FORM);i++;
XtSetArg(args,XmNrightAttachment,XmATTACH_FORM);i++;
mybutton=XtCreateManagedWidget("button",xmPushButtonWidgetClass,myform,args,i);

btn_text=XmStringCreateLtoR("Hello World!",XmSTRING_DEFAULT_CHARSET);
i=0;
XtSetArg(args,XmNlabelString,btn_text);i++;
XtSetArg(args,XmNtopWidget,mybutton);i++;
XtSetArg(args,XmNtopAttachment,XmATTACH_WIDGET);i++;
XtSetArg(args,XmNleftAttachment,XmATTACH_FORM);i++;
XtSetArg(args,XmNrightAttachment,XmATTACH_FORM);i++;
XtSetArg(args,XmNbottomAttachment,XmATTACH_FORM);i++;
mylabel=XtCreateManagedWidget("Hello",xmLabelWidgetClass,myform,args,i);

XtAddCallback(mybutton,XmNactivateCallback,activateCB,NULL);

XtRealizeWidget(toplevel);

XtAppMainLoop(app_context);

return 1;
}

void activateCB(w,client_data,call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;

{
printf("PushButton selected.\n");
XmStringFree(btn_text);
exit(0);
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-15 09:07 , Processed in 0.035633 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表