[comp.windows.x.motif] Problems compiling FileSelectionBox Widget

tmerklin@fwhnm02.fwrdc.rtsg.mot.com (Teresa Merklin) (05/17/91)

I'm attempting to add a File selection box to an application, but
can't get past compiling it without the following error:

ld: Undefined external -
_regcmp
_regex
ld: output file still contains undefined symbols
ld: (Warning) did not generate an output file


I've tried to create it using XmCreateFileSelectionBox, 
XmCreateFileSelectionDialog, and 
XtCreateWidget(xmFileSelectionBoxWidgetClass) and all three ways
give me the same error.

I can comment out that one line of code, and the application compiles.
In addition I have SelectionBox's all over the application that
compile and execute fine, so I'm pretty sure it has something to
do with the use of the File Selection Box.

Has anyone else had this sort of a problem?
-- 
/////////////////////////////////////////////////////////////////////////////
// Teresa Barley Merklin                    / Internet: tmerklin@mot.com   //
// Network Operations and Management        / Internal: TX14/1D            //   
// Fort Worth Research & Development Center / Voice:    (817) 232-6565     //
// Motorola, Inc.                           / Fax:      (817) 232-6081     //
/////////////////////////////////////////////////////////////////////////////

slh@gibdo.engr.washington.edu (05/21/91)

In article <1991May17.144227.4363@fwhnm02.fwrdc.rtsg.mot.com> tmerklin@fwhnm02.fwrdc.rtsg.mot.com.UUCP () writes:
|
|I'm attempting to add a File selection box to an application, but
|can't get past compiling it without the following error:
|
|ld: Undefined external -
|_regcmp
|_regex
|ld: output file still contains undefined symbols
|ld: (Warning) did not generate an output file
|
	Semi-obviously you're missing a library;
	you don't give the compile/link command, but I believe
	you are missing -lPW on it.

kaleb@thyme.jpl.nasa.gov (Kaleb Keithley) (05/21/91)

In article slh@gibdo.engr.washington.edu writes:
>In article tmerklin@fwhnm02.fwrdc.rtsg.mot.com.UUCP () writes:
>|
>|I'm attempting to add a File selection box to an application, but
>|can't get past compiling it without the following error:
>|
>|ld: Undefined external -
>|_regcmp
>|_regex
>|ld: output file still contains undefined symbols
>|ld: (Warning) did not generate an output file
>|
>	Semi-obviously you're missing a library;
>	you don't give the compile/link command, but I believe
>	you are missing -lPW on it.

Perhaps it's not as semi-obvious as you think.  All the world's not SysV.
If you're compiling on a Sun, for instance, you need to re-read the
Release Notes and Porting Guide and pay attention in the section about Sun.  
Specifically, on Sun, you need to add -DNO_REGEX to the list of defines.  
Furthermore, if you're on Sun SPARC, there are some other #defines that you 
will need also.  Sun is just one example; I'm will to bet that there are 
other systems that don't have regex and regcmp.

-- 
Kaleb Keithley                        kaleb@thyme.jpl.nasa.gov

Meep Meep                             Roadrunner
Veep veep                             Quayle

slh@gibdo.engr.washington.edu (05/22/91)

In article <1991May21.151752.29000@thyme.jpl.nasa.gov> kaleb@thyme.jpl.nasa.gov (Kaleb Keithley) writes:
|In article slh@gibdo.engr.washington.edu writes:
|>In article tmerklin@fwhnm02.fwrdc.rtsg.mot.com.UUCP () writes:
|>|
|>|I'm attempting to add a File selection box to an application, but
|>|can't get past compiling it without the following error:
|>|
|>|ld: Undefined external -
|>|_regcmp
|>|_regex
|>|ld: output file still contains undefined symbols
|>|ld: (Warning) did not generate an output file
|>|
|>	Semi-obviously you're missing a library;
|>	you don't give the compile/link command, but I believe
|>	you are missing -lPW on it.
|
|Perhaps it's not as semi-obvious as you think.  All the world's not SysV.
	No, an unresolved external caused by a missing library or
	object module is exactly what's wrong.
	There may not be a library to link with to fix it,
	and there may be other things to fix the root cause
	but that is the	problem with the link described above.

dbrooks@osf.org (05/23/91)

|>|I'm attempting to add a File selection box to an application, but
|>|can't get past compiling it without the following error:
|>|
|>|ld: Undefined external -
|>|_regcmp
|>|_regex
|>|ld: output file still contains undefined symbols
|>|ld: (Warning) did not generate an output file
|>|
|>	Semi-obviously you're missing a library;

Maybe.

>	No, an unresolved external caused by a missing library or
>	object module is exactly what's wrong.

Maybe.

The correct solution, if you have access to the Motif source, or you can put
your hands round the throat of whoever supplied the binaries, is to re-compile
FileSB.c with -DNO_REGEX, as described in the release notes.  This was actually
working by 1.0.2, and in all of 1.1.x.

(The above, and the below, assumes that if you don't have regcmp in your libc,
you do have re_comp.  Everyone I've met has one or the other).

If you can't get at the source, link in a module patterned something like this
(not tested; it's been a while since we dealt with this).

char *regcmp(a, b)
 char *a, *b;
{
 char *re_comp();
 return re_comp(a) ? (char *)0 : a;
}

int regex(a, b)
 char *a, *b;
{
 int re_exec();
 return re_exec(b);
}

David Brooks
Systems Engineering
Open Software Foundation