Error compiling program - Maths library failure?

by icarusbop   Last Updated July 12, 2019 09:02 AM - source

I have Ubuntu server (no GIU) version Ubuntu 16.04.3 LTS and an trying to install a program 'parsefsh-1.0-g231'.

I have downloaded the file and de-compressed it fine, now I need to compile it, so have tried 'make' but get the following error..

gcc -Wall -Wextra -g -std=gnu99 -DHAVE_VLOG   -c -o projection.o projection.c
gcc -lm  parsefsh.o fshfunc.o projection.o   -o parsefsh
projection.o: In function `init_ellipsoid':
/home/ian/parsefshsrc/parsefsh-1.0-g231/projection.c:51: undefined reference to `pow'
/home/ian/parsefshsrc/parsefsh-1.0-g231/projection.c:51: undefined reference to `sqrt'
projection.o: In function `phi_rev_merc':
/home/ian/parsefshsrc/parsefsh-1.0-g231/projection.c:66: undefined reference to `sin'
/home/ian/parsefshsrc/parsefsh-1.0-g231/projection.c:67: undefined reference to `exp'
projection.o: In function `northing':
/home/ian/parsefshsrc/parsefsh-1.0-g231/projection.c:95: undefined reference to `tan'
/home/ian/parsefshsrc/parsefsh-1.0-g231/projection.c:95: undefined reference to `sin'
projection.o: In function `coord_diff':
/home/ian/parsefshsrc/parsefsh-1.0-g231/projection.c:111: undefined reference to `cos'
/home/ian/parsefshsrc/parsefsh-1.0-g231/projection.c:113: undefined reference to `atan2'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'parsefsh' failed
make: *** [parsefsh] Error 1

(there were more lines with different maths functions but I've removed them to shorten this message)

It looks to my No0b eyes an issue with the maths functions, I've done some Internet searching and a recommendation was found to try the following...

gcc projection.c -o projection.o -lm

but this gives me an error

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

Now I'm stuck and can't really find any other answers on the Internet, can anyone help please?



Related Questions


Error compiling DVDStyler 3.0.4

Updated December 16, 2018 22:02 PM

Compilling Aimtux ImGUI Fatal Issue

Updated May 29, 2017 09:02 AM


Trying to install Tp-Link card | Make won't work

Updated November 30, 2017 23:02 PM

"make" and "make install" never work

Updated May 15, 2015 03:00 AM