Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!jstravis
From: jstravis@athena.mit.edu (John S. Travis)
Newsgroups: comp.windows.x
Subject: Linking Libraries/Undefined variables
Summary: HELP!!!
Message-ID: <13489@bloom-beacon.MIT.EDU>
Date: 14 Aug 89 22:58:42 GMT
References: <12086@orstcs.CS.ORST.EDU>
Sender: daemon@bloom-beacon.MIT.EDU
Reply-To: jstravis@athena.mit.edu (John S. Travis)
Organization: Massachusetts Institute of Technology
Lines: 122
Once again I cry for help:
1)why does the order of linking libraries affect stuff? I changed the places
of Xw and Xt on young's oneline textwidget and got this. (compile calls
the gnu cc).
w20-575-59% compile oneline.c -lXt -lXw -lX11 -g
Undefined:
_XtDestroyGC
_XtGetGC
_tempnam
w20-575-59% compile oneline.c -lXw -lXt -lX11 -g
Undefined:
_tempnam
And why on this short program do I have trouble, whereas
when i compile the larger draw(modified) program of his I can -lXt -lXw -X11
and not have XtGetGC & XtDestroyGC undefined??(I actually use them in
the draw program, but not in oneline.c)
---------------------------------------------
2)What the heck is tempnam????!!! I have fgrep almost every file I can
think of for it and it is NOWHERE! I'll include the code below. But,
I'm going crazy trying to eliminate this error. (Probably a real stupid
mistake...but TELL me I can take it.Thanks)
john travis
jstravis@athena.mit.edu
---------------------------code cut here---------------------------
/*************************************************
* oneline.c : Create a single line editable field
*************************************************/
#include
#include
#include
#include
#define FONTHEIGHT(f) ((f)->max_bounds.ascent + \
(f)->max_bounds.descent)
Widget create_one_line_text_widget();
main(argc,argv)
int argc;
char *argv[];
{
Widget toplevel;
Arg wargs[1];
toplevel = XtInitialize(argv[0],"Edit",NULL,0,&argc,argv);
XtSetArg(wargs[0],XtNeditType,XwtextEdit);
create_one_line_text_widget("edit",toplevel,wargs,1);
XtRealizeWidget(toplevel);
XtMainLoop();
}
/*
* just ring the terminal bell
*/
static void beep(w,event,params, num_params)
Widget w;
XEvent *event;
String *params;
int num_params;
{
XBell(XtDisplay(w),100);
}
/*
* associate the action beep with the function
*/
static XtActionsRec actionsTable [] ={
{"beep",beep},
};
/*
*override all translations that enter a newline.
*/
static char defaultTranslations[] =
"CtrlO: beep() \n\
CtrlM: beep() \n\
Return: beep()";
Widget create_one_line_text_widget(name,parent,args, nargs)
char *name;
Widget parent;
Arg args[];
int nargs;
{
XFontStruct *font;
Widget w;
Arg wargs[1];
XtTranslations trans_table;
/*
* Add the actions and compile the translations
*/
XtAddActions(actionsTable,XtNumber(actionsTable));
trans_table = XtParseTranslationTable(defaultTranslations);
/*
* Create a textEdit widget
*/
w = XtCreateManagedWidget(name, XwtexteditWidgetClass,parent,args,nargs);
/*
* install our tranlstions
*/
XtOverrideTranslations(w,trans_table);
/*
*get the font used by the widget
*/
XtSetArg(wargs[0],XtNfont,&font);
XtGetValues(w,wargs,1);
/*
* set the widget height according to the font height
*/
XtSetArg(wargs[0],XtNheight,FONTHEIGHT(font) + 6);
XtSetValues(w,wargs,1);
return(w);
}