I am trying to compile my own example and I am getting the following error:
pi@raspberrypi ~/Astro/libnova-0.15.0/examples $ gcc mars.c -o testmars
/tmp/ccuct9Oi.o: In function main':
mars.c:(.text+0xe8): undefined reference to
ln_get_julian_from_sys'
mars.c:(.text+0x108): undefined reference to ln_get_mars_helio_coords'
mars.c:(.text+0x13c): undefined reference to
ln_get_mars_equ_coords'
mars.c:(.text+0x150): undefined reference to ln_equ_to_hequ'
mars.c:(.text+0x1a0): undefined reference to
ln_get_mars_earth_dist'
mars.c:(.text+0x1b8): undefined reference to ln_get_mars_solar_dist'
mars.c:(.text+0x1d0): undefined reference to
ln_get_mars_disk'
mars.c:(.text+0x1e8): undefined reference to ln_get_mars_magnitude'
mars.c:(.text+0x200): undefined reference to
ln_get_mars_phase'
mars.c:(.text+0x228): undefined reference to ln_get_mars_rst'
mars.c:(.text+0x254): undefined reference to
ln_get_local_date'
mars.c:(.text+0x268): undefined reference to ln_get_local_date'
mars.c:(.text+0x27c): undefined reference to
ln_get_local_date'
collect2: error: ld returned 1 exit status
This is using just the example mars.c that ships with it, no changes made to it.
I am not very familular with C, so I am sure its some thing simple causing it. Any help would be wonderful.
Ah I just figured it out right after I posted. I need to use libtool to compile it. So something like this:
pi@raspberrypi ~/Astro/libnova-0.15.0/examples $ gcc -c testmars.c -o testmars.o
pi@raspberrypi ~/Astro/libnova-0.15.0/examples $ ../libtool --tag=CC --mode=link gcc -Wall -o testmars testmars.o ../src/libnova.la -lm
Hi Brian,
On 13 November 2015 at 19:56, Brian blee1170@users.sf.net wrote:
Yep, if you are compiling against a non installed version of libnova then
you need to use libtool etc (the examples use this method). If libnova is
installed on your system lib path then you just need to use -lnova as a gcc
option.
Thanks
Liam
Related
Bugs: #17