Re: newbie xlib/xt question

2007-03-01 Thread Agostino Ruscito

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

BTW those are not really LDFLAGS it's the flags and the libraries, the problem
with unresolved symbols is caused by the order in which the libraries are 
searched.
--
René Berber




Thank you very much. Now it work !

--
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/



newbie xlib/xt question

2007-02-28 Thread Agostino Ruscito

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/



Re: newbie xlib/xt question

2007-02-28 Thread René Berber
Agostino Ruscito wrote:

 apologies for my poor English) I just installed cygwin.
 I'm trying to compile a program under cygwin, but I got some errors.
[snip]
 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'
...
 Do I missing some lib in the Makefile?

No, the problem is the order of the parameters, put your LDFLAGS at the end in
the makefile:

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

BTW those are not really LDFLAGS it's the flags and the libraries, the problem
with unresolved symbols is caused by the order in which the libraries are 
searched.
-- 
René Berber


--
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/