newbie xlib/xt question

Agostino Ruscito ruscito@gmail.com
Thu Mar 1 03:20:00 GMT 2007


apologies for my poor English) I just installed cygwin.
 I'm trying to compile a program under cygwin, but I got some errors.

This is the program :

#include <Xm/Xm.h>    /* Standard Motif definitions */
#include <Xm/Label.h>     /* Motif Label Widget */
main(argc, argv)
int argc;
char **argv;
{
    XtAppContext app_context;
    Widget topLevel, hello;

    /* Register the default language procedure */
        XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL);

    /* Initialize the Xt Intrinsics */
    topLevel = XtVaAppInitialize(
            &app_context,       /* Application context */
            "XHello",               /* Application class */
            NULL, 0,                /* command line option list */
            &argc, argv,        /* command line args */
            NULL,                   /* for missing app-defaults file */
            NULL);                  /* terminate varargs list */

        /* Create a widget */
    hello = XtVaCreateManagedWidget(
            "hello",                /* arbitrary widget name */
            xmLabelWidgetClass,     /* widget class from Label.h */
            topLevel,               /* parent widget */
            NULL);                  /* terminate varargs list */

    /*
     *  Create windows for widgets and map them.
     */
    XtRealizeWidget(topLevel);

    /*
     *  Loop for events.
     */
    XtAppMainLoop(app_context);
}

__________________________________________________________________________

this is the Makefile that I'm using ( work under freebsd)

CC = gcc
# the linker is also "gcc". It might be something else with other
#compilers.
LD = gcc
# Compiler flags go here.
CFLAGS =  -I/usr/X11R6/include
LDFLAGS = -L/usr/X11R6/lib -lXm -lXt -lX11 -lICE -lSM -lXext

# use this command to erase files.
RM = /bin/rm -f
# list of generated object files.
OBJS = xhello.o
# program executable file name.
PROG = xhello

# top-level rule, to compile everything.
all: $(PROG)

# rule to link the program
$(PROG): $(OBJS)
        $(LD) $(LDFLAGS) $(OBJS) -o $(PROG)

# rule for file "xhello.o".
xhello.o:xhello.c
        $(CC) $(CFLAGS) -c xhello.c


# rule for cleaning re-compilable files.
clean:
        $(RM) $(PROG) $(OBJS)

_______________________________________________________________

These are the error:

$ make
gcc -L/usr/X11R6/lib -lXm -lXt -lX11 -lICE -lSM -lXext xhello.o  -o xhello
xhello.o:xhello.c:(.text+0x42): undefined reference to `_XtSetLanguageProc'
xhello.o:xhello.c:(.text+0x83): undefined reference to `_XtVaAppInitialize'
xhello.o:xhello.c:(.text+0x9a): undefined reference to `_xmLabelWidgetClass'
xhello.o:xhello.c:(.text+0xaa): undefined reference to `_XtVaCreateManagedWidget
'
xhello.o:xhello.c:(.text+0xb8): undefined reference to `_XtRealizeWidget'
xhello.o:xhello.c:(.text+0xc3): undefined reference to `_XtAppMainLoop'
collect2: ld returned 1 exit status
make: *** [xhello] Error 1

Do I missing some lib in the Makefile?

Thanks for your time

Agostino

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/



More information about the Cygwin-xfree mailing list