linking math library

Hi,

I am trying to link a program that links the math library, but keep getting
the following link errors:

undefined symbol __CHK
undefined symbol fltused
undefined symbol __8087

I am including math.h in my source. Using the -fp5 compiler option and
linking the math387r.lib library.
What am I doing wrong? Any help would be appreciated.

Thanks,

Piyush

David,

Thanks for the response. I do have a main function. If there are any other
suggestions, please let me know.

Thanks,

Piyush
David Gibbs wrote in message <95uvv2$s22$2@nntp.qnx.com>…

piyushm <> piyush@holomage.com> > wrote:
Hi,

Do you not have a main() function?

All C programs must have a main() function.

-David

I am trying to link a program that links the math library, but keep
getting
the following link errors:

undefined symbol __CHK
undefined symbol fltused
undefined symbol __8087

I am including math.h in my source. Using the -fp5 compiler option and
linking the math387r.lib library.
What am I doing wrong? Any help would be appreciated.

Thanks,

Piyush


\

QNX Training Services
dagibbs@qnx.com

Augie,

I took out the library linking and used -fp3 instead. Still got the same
errors. Here is what the makefile looks like:

…SILENT:

CC=cc

INCVDK = /usr/sdvdkqnx/include
INCNET = /usr/sdvdkqnx/include
LIB=-L/usr/lib -L/usr/sdvdkqnx/lib -lsdvdkqnx

CFLAGS=-fp3 -T1 -5 -mf -g2 -DCAM_VERSION=’“v1.4”’


all:
make clean
make holocopy

clean:
touch *.c
rm -f *.o

COBJECTS= autof.o bitmap.o scalec.o copy.o

copy.o: copy.c /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) -c -I$(INCVDK) -I$(INCNET) -o $@ $< $(LIB)

autof.o: autof.c /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) -c -I$(INCVDK) -I$(INCNET) -o $@ $< $(LIB)

bitmap.o:bitmap.c /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) -c -I$(INCVDK) -I$(INCNET) -o $@ $< $(LIB)

scalec.o:scalec.c /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) -c -I$(INCVDK) -I$(INCNET) -o $@ $< $(LIB)


holocopy: $(COBJECTS) /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) $(CFLAGS) -o $@ $< $(LIB)


Augie Henriques wrote in message

I’m using -fp3 and math.h but I don’t have to link math387r.lib. I would
suggest taking the library linking out. If that doesn’t work, try using
the -fp3 instead (for a while).

What are your compile/link flags. Post your Makefile.

Augie Henriques

piyushm <piyush@holomage.com> wrote:

Hi,

Do you not have a main() function?

All C programs must have a main() function.

-David

I am trying to link a program that links the math library, but keep getting
the following link errors:

undefined symbol __CHK
undefined symbol fltused
undefined symbol __8087

I am including math.h in my source. Using the -fp5 compiler option and
linking the math387r.lib library.
What am I doing wrong? Any help would be appreciated.

Thanks,

Piyush


QNX Training Services
dagibbs@qnx.com

“piyushm” <piyush@holomage.com> wrote in message
news:95v2mh$qk2$1@inn.qnx.com

David,

Thanks for the response. I do have a main function. If there are any
other
suggestions, please let me know.

Thanks,

Piyush
David Gibbs wrote in message <95uvv2$s22$> 2@nntp.qnx.com> >…
piyushm <> piyush@holomage.com> > wrote:
Hi,

Do you not have a main() function?

All C programs must have a main() function.

-David

I am trying to link a program that links the math library, but keep
getting
the following link errors:

undefined symbol __CHK
undefined symbol fltused
undefined symbol __8087

I am including math.h in my source. Using the -fp5 compiler option and
linking the math387r.lib library.
What am I doing wrong? Any help would be appreciated.

I’m using -fp3 and math.h but I don’t have to link math387r.lib. I would
suggest taking the library linking out. If that doesn’t work, try using
the -fp3 instead (for a while).

What are your compile/link flags. Post your Makefile.

Augie Henriques

Thanks,

Piyush


\

QNX Training Services
dagibbs@qnx.com

“piyushm” <piyush@holomage.com> wrote in message
news:95v642$sjh$1@inn.qnx.com

Augie,

I took out the library linking and used -fp3 instead. Still got the same
errors. Here is what the makefile looks like:

.SILENT:

CC=cc

INCVDK = /usr/sdvdkqnx/include
INCNET = /usr/sdvdkqnx/include
LIB=-L/usr/lib -L/usr/sdvdkqnx/lib -lsdvdkqnx

CFLAGS=-fp3 -T1 -5 -mf -g2 -DCAM_VERSION=’“v1.4”’

I use -3 -fp3 -mf -zp2 -F -Osax -w5. Have you tried taking out the -g2
flag?

Augie

all:
make clean
make holocopy

clean:
touch *.c
rm -f *.o

COBJECTS= autof.o bitmap.o scalec.o copy.o

copy.o: copy.c /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) -c -I$(INCVDK) -I$(INCNET) -o $@ $< $(LIB)

autof.o: autof.c /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) -c -I$(INCVDK) -I$(INCNET) -o $@ $< $(LIB)

bitmap.o:bitmap.c /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) -c -I$(INCVDK) -I$(INCNET) -o $@ $< $(LIB)

scalec.o:scalec.c /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) -c -I$(INCVDK) -I$(INCNET) -o $@ $< $(LIB)


holocopy: $(COBJECTS) /usr/sdvdkqnx/lib/sdvdkqnx.lib
$(CC) $(CFLAGS) -o $@ $< $(LIB)


Augie Henriques wrote in message

I’m using -fp3 and math.h but I don’t have to link math387r.lib. I would
suggest taking the library linking out. If that doesn’t work, try using
the -fp3 instead (for a while).

What are your compile/link flags. Post your Makefile.

Augie Henriques
\

piyushm wrote:

I am trying to link a program that links the math library, but keep getting
the following link errors:

undefined symbol __CHK
undefined symbol fltused
undefined symbol __8087

I am including math.h in my source. Using the -fp5 compiler option and
linking the math387r.lib library.
What am I doing wrong? Any help would be appreciated.

I was trapped by a similar problems some years ago, so my suggestion is
not
up-to-date:

Can you put a dummy operation like

{
volatile double a =1.0;
a += 1.2;
}

somewhere in your main and retry?

As far as I remember there was a weakness in the WATCOM linker, not to
link in some math function if there’s no real float/double operation
in the objects.

HTH,

Karsten.


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

piyushm wrote:

I am trying to link a program that links the math library, but keep getting
the following link errors:

undefined symbol __CHK
undefined symbol fltused
undefined symbol __8087

I am including math.h in my source. Using the -fp5 compiler option and
linking the math387r.lib library.
What am I doing wrong? Any help would be appreciated.

I was trapped by a similar problems some years ago, so my suggestion is
not
up-to-date:

Can you put a dummy operation like

{
volatile double a =1.0;
a += 1.2;
}

somewhere in your main and retry?

As far as I remember there was a weakness in the WATCOM linker, not to
link in some math function if there’s no real float/double operation
in the objects.

HTH,

Karsten.


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld