Menu

#17 gcc compile question.

v1.0_(example)
open
nobody
None
5
2015-11-13
2015-11-13
Brian
No

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 toln_get_julian_from_sys'
mars.c:(.text+0x108): undefined reference to ln_get_mars_helio_coords' mars.c:(.text+0x13c): undefined reference toln_get_mars_equ_coords'
mars.c:(.text+0x150): undefined reference to ln_equ_to_hequ' mars.c:(.text+0x1a0): undefined reference toln_get_mars_earth_dist'
mars.c:(.text+0x1b8): undefined reference to ln_get_mars_solar_dist' mars.c:(.text+0x1d0): undefined reference toln_get_mars_disk'
mars.c:(.text+0x1e8): undefined reference to ln_get_mars_magnitude' mars.c:(.text+0x200): undefined reference toln_get_mars_phase'
mars.c:(.text+0x228): undefined reference to ln_get_mars_rst' mars.c:(.text+0x254): undefined reference toln_get_local_date'
mars.c:(.text+0x268): undefined reference to ln_get_local_date' mars.c:(.text+0x27c): undefined reference toln_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.

Related

Bugs: #17

Discussion

  • Brian

    Brian - 2015-11-13

    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

     
    • Liam Girdwood

      Liam Girdwood - 2015-11-16

      Hi Brian,

      On 13 November 2015 at 19:56, Brian blee1170@users.sf.net wrote:

      Ah I just figured it out right after I posted. I need to use libtool to
      compile it. So something like this:

      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

      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


      Status: open
      Group: v1.0_(example)
      Created: Fri Nov 13, 2015 07:45 PM UTC by Brian
      Last Updated: Fri Nov 13, 2015 07:45 PM UTC
      Owner: nobody

      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 toln_get_julian_from_sys'
      mars.c:(.text+0x108): undefined reference to ln_get_mars_helio_coords'
      mars.c:(.text+0x13c): undefined reference toln_get_mars_equ_coords'
      mars.c:(.text+0x150): undefined reference to ln_equ_to_hequ'
      mars.c:(.text+0x1a0): undefined reference toln_get_mars_earth_dist'
      mars.c:(.text+0x1b8): undefined reference to ln_get_mars_solar_dist'
      mars.c:(.text+0x1d0): undefined reference toln_get_mars_disk'
      mars.c:(.text+0x1e8): undefined reference to ln_get_mars_magnitude'
      mars.c:(.text+0x200): undefined reference toln_get_mars_phase'
      mars.c:(.text+0x228): undefined reference to ln_get_mars_rst'
      mars.c:(.text+0x254): undefined reference toln_get_local_date'
      mars.c:(.text+0x268): undefined reference to ln_get_local_date'
      mars.c:(.text+0x27c): undefined reference toln_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.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/libnova/bugs/17/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #17


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.