LinuxFreeBSD

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ LinuxFreeBSD ] in KIDS
글 쓴 이(By): burp (spider)
날 짜 (Date): 1999년 5월  8일 토요일 오후 05시 01분 50초
제 목(Title): [Q]Motif 프로그램 컴파일하기 II


안녕하세요 계속 같은 질문인데요 
아래의 callback.cc화일을 다음과 같이 컴파일했는데 계속 에러가
나는군요. 

-------------------------------------------------------------------------
g++ -g callback.cc -I/usr/X11R6/include -L/usr/X11R6/lib

/tmp/cca021921.o: In function `main':
/home/oofe/test/callback.cc:26: undefined reference to `XtAppInitialize'
/home/oofe/test/callback.cc:31: undefined reference to `_XmStrings'
/home/oofe/test/callback.cc:31: undefined reference to `XmStringCreate'
/home/oofe/test/callback.cc:32: undefined reference to `XmCreatePushButton'
/home/oofe/test/callback.cc:33: undefined reference to `XtManageChild'
/home/oofe/test/callback.cc:34: undefined reference to `_XmStrings'
/home/oofe/test/callback.cc:34: undefined reference to `XtAddCallback'
/home/oofe/test/callback.cc:36: undefined reference to `XtRealizeWidget'
/home/oofe/test/callback.cc:37: undefined reference to `XtAppMainLoop'
/tmp/cca021921.o: In function `handle_button(_WidgetRec *, void *, void *)':
/home/oofe/test/callback.cc:15: undefined reference to `_XmStrings'
collect2: ld returned 1 exit status

Compilation exited abnormally with code 1 at Sat May  8 16:51:29

------------------------------------------------------------------------------

#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/PushB.h>

XtAppContext context;
XmStringCharSet char_set = XmSTRING_DEFAULT_CHARSET;

Widget toplevel, button;

void handle_button(Widget w, XtPointer client_data, XtPointer call_data)
    
/* handle the pushbutton's activate callback. */
{
  printf("button pushed\n");
}

void main(int argc, char **argv)
{
  Arg al[10];
  int ac;

  /* create the toplevel shell */
  toplevel = XtAppInitialize(&context, "", NULL, 0, &argc, argv, 
     NULL, NULL, 0);

  /* create the button widget */
  ac = 0;
  XtSetArg(al[ac], XmNlabelString,
   XmStringCreate("Push Me", char_set)); ac++;
  button = XmCreatePushButton(toplevel, "button", al, ac);
  XtManageChild(button);
  XtAddCallback(button, XmNactivateCallback, handle_button, NULL);

  XtRealizeWidget(toplevel);
  XtAppMainLoop(context);
}
[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.