Symbols not found for architecture: trouble compiling with C++


 
Thread Tools Search this Thread
Top Forums Programming Symbols not found for architecture: trouble compiling with C++
# 1  
Old 06-04-2013
Symbols not found for architecture: trouble compiling with C++

Hello,
I am writing a program which relies on some heavy astronomy calculations, so I am using libnova c++ astronomy libraries => libnova: libnova.
I started off with a simple program to make sure everything compiled ok (below)
Code:
//Simple example program to test Libnova C++ class libraries

#include <stdio.h>
#include <libnova/lunar.h>
#include <libnova/julian_day.h>

int main (int argc, char* argv[])
{
    double JD;
    double moonDisk;
    //Get Julian Date from System
    JD = ln_get_julian_from_sys(); //function from julian_day.c
    
    //Use JD to calculate the illuminated lunar disk percentage
    moonDisk = ln_get_lunar_disk(JD); //function from lunar.c
    return 0;
}

But when I try to compile this, using
Code:
g++ -o Astro AstroTest.cpp

I receive the following error:
Undefined symbols for architecture x86_64:
"_ln_get_julian_from_sys", referenced from:
_main in ccrtNz4O.o
"_ln_get_lunar_disk", referenced from:
_main in ccrtNz4O.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status


I researched this error and it seems like it is pretty general. I am using a MacbookPro OSX 10.8, and "uname -m" gives me "x86_64". And when I run
Code:
file lib/libnova.dylib

I get "Mach-O 64-bit dynamically linked shared library x86_64". I am not sure what the problem is here, any help would be very appreciated.
Thanks
# 2  
Old 06-04-2013
You have to tell g++ to use the library.

Code:
g++ -o Astro AstroTest.cpp lib/libnova.dylib

This User Gave Thanks to Corona688 For This Post:
# 3  
Old 06-04-2013
That works... Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Compiling libcdio-paranoia, gcc found - C compiler doesnt work

Heyas I'm currently trying to make a fresh build from scratch/source of FFMPEG. This said, it brings quite a tail with it, so the use of a script was very obvious. Anyway, i'm currently stuck at named package. Lets ignore the tarball/download line, as the error is after. Commands... (0 Replies)
Discussion started by: sea
0 Replies

2. Programming

Trouble compiling program using the readline library.

Hi: in the info page for readline library I read -- Function: void rl_variable_dumper (int readable) Print the readline variable names and their current values to `rl_outstream'. If READABLE is non-zero, the list is formatted in such a way that it can be made part of an... (1 Reply)
Discussion started by: stf92
1 Replies

3. UNIX and Linux Applications

Cross Compiling Issue of udev-151 for MIPS Little Endain Architecture

Hi All, I am trying to cross compile udev-151 for MIPS little endian architecture. I am configuring like this: ./configure --prefix=$PWD/sree --host=mips-linux-gnu configure: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then... (3 Replies)
Discussion started by: bsreeram
3 Replies

4. Programming

MinGW - Trouble Compiling Guile

This question is not about programming but compiling with GNU GCC/Make. I am not on a UNIX machine but am using the UNIX-like environment MSYS with MinGW for compiling. The problem that I am having is that I cannot get guile to compile. For some reason it cannot find libltdl which is part of... (3 Replies)
Discussion started by: Deluge
3 Replies

5. Solaris

cc not found error in compiling perl modules

:rolleyes:make cc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xO3 -xdepend -DVERSION="2.121\" -DXS_VERSION=\"2.121\" -KPIC -I/usr/perl5/5.6.1/lib/sun4-solaris-64int/CORE Dumper.c make: cc: Command not found make: *** Error 127 cc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8... (0 Replies)
Discussion started by: priyophan
0 Replies

6. AIX

Unresolved symbols

Hello experts , i have some strange problem, i wanted to create a shared object in AIX 5.3 for which i have compiled all my .cxx to .o which worked fine and then i created the .so from them , but when i do nm -Bo sample.so , i have many unresolved symbol, including printf... (0 Replies)
Discussion started by: vin_pll
0 Replies

7. HP-UX

bash...Not found through where(compiling source file)

Hi i have compiled and installed bash 3.2 on my hp-ux parisc its in path /usr/local/pkg/bash/bin/bash .....When im search for this bash (through whereis bash) im not findind but other which i hve done in same procedure( gettext,m4) ..Im able to find through whereis search option can any1... (3 Replies)
Discussion started by: vasanthan
3 Replies

8. Programming

undefined symbols

i am trying to compile transcode on AIX v 4.3.3 with gcc 3.0.1 i am getting this error: gcc -shared -o .libs/libexport_null.so.0 export_null.o -lpthread -ldl -lc -Wl,-bnoentry -Wl,-bexport:.libs/libexport_null.exp ld: 0711-317 ERROR: Undefined symbol: capability_flag ld: 0711-317... (0 Replies)
Discussion started by: thalex
0 Replies
Login or Register to Ask a Question