[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

compile problem



Hi everyone,
 
I am trying to compile the following program. But from the output I get the feeling that not all links are made. I believe this is due to the fact that not all libraries are included during the compilation. The problem is that I don't know what libraries to pass with my gcc test.c command so that the linking does go well. Can anybody tell me if I am correct and if so what libraries to pass during compilation?
 
Thanks in advance
 
Paul Akkermans
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <stdio.h>
 
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Box.h>
 
/*  exit the program */
 
static void exitHandler(Widget w, XtPointer callData, XtPointer clientData)
  {
  exit(0);
  }
 
/* print "hello" to stdout */
 
static void helloHandler(Widget w, XtPointer callData, XtPointer clientData)
  {
  printf("Hello\n");
  }
 
/* main program */
 
void main(int argc, char **argv)
  {
  XtAppContext appContext;
  Widget toplevel, box, topLabel, bottomPanel, helloButton, exitButton;
 
  toplevel = XtVaAppInitialize(&appContext, "AthenaDemo", NULL, 0, &argc, argv, NULL, NULL);
 
  box = XtVaCreateManagedWidget("box",boxWidgetClass,toplevel,NULL);
 
  topLabel = XtVaCreateManagedWidget("topLabel", labelWidgetClass, box,
         XtNlabel," Pick One ",
         XtNborderWidth, 0,
         NULL);
 
  bottomPanel = XtVaCreateManagedWidget("bottomPanel", formWidgetClass, box,
     XtNsensitive, True,
     XtNborderWidth, 0,
     NULL);
 
  helloButton = XtVaCreateManagedWidget("helloButton", commandWidgetClass, bottomPanel,
     XtNlabel," Hello ",
     NULL);
 
  XtAddCallback(helloButton, XtNcallback, helloHandler, NULL);
 
  exitButton = XtVaCreateManagedWidget("exitButton", commandWidgetClass, bottomPanel,
           XtNlabel," Exit ",
           XtNfromHoriz,helloButton,
           NULL);
 
  XtAddCallback(exitButton, XtNcallback, exitHandler, NULL);
  XtRealizeWidget(toplevel);
  XtAppMainLoop(appContext);
  }
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
output:
debian:/home/paul/softwarecon# gcc test.c
test.c: In function `main':
test.c:26: warning: return type of `main' is not `int'
/tmp/ccKRQH3r.o: In function `main':
/tmp/ccKRQH3r.o(.text+0x50): undefined reference to `XtVaAppInitialize'
/tmp/ccKRQH3r.o(.text+0x63): undefined reference to `boxWidgetClass'
/tmp/ccKRQH3r.o(.text+0x6e): undefined reference to `XtVaCreateManagedWidget'
/tmp/ccKRQH3r.o(.text+0x7f): undefined reference to `XtStrings'
/tmp/ccKRQH3r.o(.text+0x89): undefined reference to `XtStrings'
/tmp/ccKRQH3r.o(.text+0x92): undefined reference to `labelWidgetClass'
/tmp/ccKRQH3r.o(.text+0x9d): undefined reference to `XtVaCreateManagedWidget'
/tmp/ccKRQH3r.o(.text+0xae): undefined reference to `XtStrings'
/tmp/ccKRQH3r.o(.text+0xb5): undefined reference to `XtStrings'
/tmp/ccKRQH3r.o(.text+0xbe): undefined reference to `formWidgetClass'
/tmp/ccKRQH3r.o(.text+0xc9): undefined reference to `XtVaCreateManagedWidget'
/tmp/ccKRQH3r.o(.text+0xe0): undefined reference to `XtStrings'
/tmp/ccKRQH3r.o(.text+0xe9): undefined reference to `commandWidgetClass'
/tmp/ccKRQH3r.o(.text+0xf4): undefined reference to `XtVaCreateManagedWidget'
/tmp/ccKRQH3r.o(.text+0x108): undefined reference to `XtStrings'
/tmp/ccKRQH3r.o(.text+0x111): undefined reference to `XtAddCallback'
/tmp/ccKRQH3r.o(.text+0x129): undefined reference to `XtStrings'
/tmp/ccKRQH3r.o(.text+0x132): undefined reference to `commandWidgetClass'
/tmp/ccKRQH3r.o(.text+0x13d): undefined reference to `XtVaCreateManagedWidget'
/tmp/ccKRQH3r.o(.text+0x151): undefined reference to `XtStrings'
/tmp/ccKRQH3r.o(.text+0x15a): undefined reference to `XtAddCallback'
/tmp/ccKRQH3r.o(.text+0x169): undefined reference to `XtRealizeWidget'
/tmp/ccKRQH3r.o(.text+0x178): undefined reference to `XtAppMainLoop'
collect2: ld returned 1 exit status
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
 

Reply to: