Reputation: 13
First of all : I am a newbee in linux.
2nd -- I have seen What is missing in my makefile? but did not still get what is wrong with my make file. Though I am getting the same errors he was getting. Error that I am getting after running the makefile:
user@ubuntu:~/Documents/Myfiles/Adaptive Doppler$ make adaptiveav
gcc -o adaptiveav simpsimaav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o -g
simpsimaav.o: In function `main':
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:179: undefined reference to `cos'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:180: undefined reference to `sin'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:299: undefined reference to `sin'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:299: undefined reference to `sin'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:299: undefined reference to `sin'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:325: undefined reference to `sqrt'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:325: undefined reference to `sqrt'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:326: undefined reference to `cos'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:327: undefined reference to `sin'
simpsimaav.o: In function `rayleigh':
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:418: undefined reference to `log'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:418: undefined reference to `sqrt'
/home/user/Documents/Myfiles/Adaptive Doppler/simpsimaav.c:421: undefined reference to `sqrt'
four1.o: In function `four1':
/home/user/Documents/Myfiles/Adaptive Doppler/four1.c:47: undefined reference to `sin'
/home/user/Documents/Myfiles/Adaptive Doppler/four1.c:49: undefined reference to `sin'
collect2: error: ld returned 1 exit status
make: *** [adaptiveav] Error 1
-------------------------------------------------------------
My make file :
OBJS= main.o do_fft.o find_m.o read_sig.o write_out.o allocin.o\
getopts.o read_form.o read_bin.o optlist.o usage.o normalize.o \
enquire.o init_fft.o subdc.o skip.o shortfile.o open_out.o \
han_win.o getyn.o record.o do_mom.o frq_arry.o four1.o look_nfo.o\
do_peak.o coefs_out.o do_smooth.o do_maxf.o accum.o pspect.o except.o\
get_info.o open_in.o test_read.o getstr.o getint.o open_nfo.o line_flush.o \
simpsim1.o
# Note: these routines are found in Lib/lib.ar
LIBOBJS= debug.c div_by.c getint.c getstr.c \
init_ap.c look_nfo.c open_in.c open_nfo.c test_read.c
# LIBS= -lm /usr/local/src/Cspect/Lib/lib.ar -lfpe
LIBS = -lm
CFLAGS= -g
rtest: rtest.o realft.o four1.o
gcc -o rtest rtest.o realft.o four1.o -lm $(CFLAGS)
itest: itest.o realft.o four1.o
gcc -o itest itest.o realft.o four1.o -lm $(CFLAGS)
test: test.o four1.o
gcc -o test test.o four1.o -lm $(CFLAGS)
invtest: invtest.o four1.o
gcc -o invtest invtest.o four1.o -lm $(CFLAGS)
tabtest: test.o ffttab.o
gcc -o test test.o ffttab.o -lm $(CFLAGS)
cspect: ${OBJS}
gcc -o cspect.exe ${OBJS} ${LIBS} ${CFLAGS}
rdtest: rdtest.o read_form.o
gcc -o rdtest rdtest.o read_form.o -g
fttest: sine.o do_fft.o four1.o subdc.o do_peak.o
gcc -o fttest sine.o do_fft.o four1.o subdc.o do_peak.o
adaptive: simpsima.o findvel.o do_fft.o four1.o subdc.o do_peak.o
gcc -o adaptive simpsima.o findvel.o do_fft.o four1.o subdc.o do_peak.o -g
notadaptive: simpsimna.o findvel.o do_fft.o four1.o subdc.o do_peak.o
gcc -o notadaptive simpsimna.o findvel.o do_fft.o four1.o subdc.o do_peak.o -g
adaptivevold: simpsimavold.o findvel.o do_fft.o four1.o subdc.o do_peak.o
gcc -o adaptivevold simpsimavold.o findvel.o do_fft.o four1.o subdc.o do_peak.o
adaptivev: simpsimav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o
gcc -o adaptivev simpsimav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o -g
notadaptivev: simpsimnav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o
gcc -o notadaptivev simpsimnav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o -g
adaptiveav: simpsimaav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o
gcc -o adaptiveav simpsimaav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o -g
.c.o:
gcc -c ${CFLAGS} $*.c
#simpsim.o: simpsim.c
# gcc -c simpsim1.c
: spect
strip spect
chmod 755 spect
chgrp user spect
mv spect /usr/local/bin
This is not the directory where my lib.ar is : Is it probably for this?
# LIBS= -lm /usr/local/src/Cspect/Lib/lib.ar -lfpe
LIBS = -lm"
and I dont want you to do my works... just suggest me anything... or any useful website where they talk about these things...
I hope not to get rude comments just because I am new.
Thanks.
Upvotes: 1
Views: 115
Reputation: 72746
The undefined references are all math functions found in libm.a
. The part with the -lm
in the Makefile did not make it to the gcc command. Try adding -lm
to the gcc command and it should work. Specifically, this
adaptiveav: simpsimaav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o
gcc -o adaptiveav simpsimaav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o -g
is missing a reference to $(LIBS)
at the end.
Upvotes: 1
Reputation: 6006
adaptiveav: simpsimaav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o
gcc -o adaptiveav simpsimaav.o findvel.o do_fft.o four1.o subdc.o do_peak_n.o -g
As you can see the -lm switch isn't on that line. So the references to cos are unresolved.
Upvotes: 0