c - Makefile 抛出 undefined reference 错误

标签 c makefile

我正在尝试运行 Makefile 以使数据缩减管道在我的 PC 上运行。我的顾问修建了这条管道,但他和我目前相距 1000 英里,因此他无法提供帮助。这是我的 Makefile 的片段:

#makefile for eph's programs
####site dependent parameters###
NR = ../nrecipes #location of numerical recipes routines (and header files)
NRU = ../nrecipes/utilities #location of N.R. utilities (and header files)
NRSUBS = ../nrecipes/nrsubs #N.R. subroutine library 
SUBS = ../subroutines
OUTDIR = ../bin
###end of site dependent parameters###

#fixed frame autocorrelation routine
acorr:
    gcc acorr.c -o $(OUTDIR)/acorr $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

testacr2:
    cc testacr2.c -o $(OUTDIR)/testacr2 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#autocorrelation fitting program
acrfit:
    cc acrfit.c -o $(OUTDIR)/acrfit $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 

然后有一大堆行,就像上面所有其他 .c 文件一样,所有行都以 -lm 结尾。

尝试运行 make 时出现以下错误:

cc     ccdacr.c   -o ccdacr
ccdacr.c: In function ‘main’:
ccdacr.c:349:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
          printf("Read in FITS header. %d\n",sizeof(char));
          ^
/tmp/ccSt8UVm.o: In function `main':
ccdacr.c:(.text+0x2139): undefined reference to `sqrt'
ccdacr.c:(.text+0x30f4): undefined reference to `sqrt'
ccdacr.c:(.text+0x3125): undefined reference to `sqrt'
ccdacr.c:(.text+0x404a): undefined reference to `fourn'
ccdacr.c:(.text+0x55a3): undefined reference to `fourn'
ccdacr.c:(.text+0x5b43): undefined reference to `fourn'
/tmp/ccSt8UVm.o: In function `readnoisebias':
ccdacr.c:(.text+0x64eb): undefined reference to `sqrt'
/tmp/ccSt8UVm.o: In function `readnoisebias2':
ccdacr.c:(.text+0x690d): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
make: *** [ccdacr] Error 1

这与我保存这些文件的位置有关吗?目前它们位于我桌面上自己的文件夹中。它们位于该目录的一个名为“programs”的子文件夹中。

如果这一切都非常模糊,我很抱歉;我不太擅长 C。

编辑:这是完整的 Makefile。好长啊。

#makefile for eph's programs
####site dependent parameters###
NR = ../nrecipes #location of numerical recipes routines (and header files)
NRU = ../nrecipes/utilities #location of N.R. utilities (and header files)
NRSUBS = ../nrecipes/nrsubs #N.R. subroutine library 
SUBS = ../subroutines
OUTDIR = ../bin
###end of site dependent parameters###

#fixed frame autocorrelation routine
acorr:
    gcc acorr.c -o $(OUTDIR)/acorr $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

testacr2:
    cc testacr2.c -o $(OUTDIR)/testacr2 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#autocorrelation fitting program
acrfit:
    cc acrfit.c -o $(OUTDIR)/acrfit $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit1:
    cc acrfit1.c -o $(OUTDIR)/acrfit1 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit2:
    cc acrfit2.c -o $(OUTDIR)/acrfit2 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit3:
    cc acrfit3.c -o $(OUTDIR)/acrfit3 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit4:
    cc acrfit4.c -o $(OUTDIR)/acrfit4 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit5:
    cc acrfit5.c -o $(OUTDIR)/acrfit5 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit6:
    cc acrfit6.c -o $(OUTDIR)/acrfit6 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 
acrfit7:
    cc acrfit7.c -o $(OUTDIR)/acrfit7 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 

ftest7:
    cc ftest7.c -o $(OUTDIR)/ftest7 $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#fixed frame bispectrum routine
bispec:
    gcc bispec.c -o $(OUTDIR)/bispec $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c $(SUBS)/aalloc.c \
    $(SUBS)/fourn.c -lm;

#fixed frame bispectrum routine
tbispec:
    cc tbispec.c -o $(OUTDIR)/tbispec $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c $(SUBS)/putf.c $(SUBS)/aalloc.c \
    $(SUBS)/fourn.c -lm;

#channel saturation correction fixed frame bispectrum routine
bispenh:
    cc bispenh.c -o $(OUTDIR)/bispenh $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c $(SUBS)/putf.c $(SUBS)/aalloc.c \
    $(SUBS)/fourn.c -lm;

#speckle simulation frame blurring program
blur:
    cc blur.c -o $(OUTDIR)/blur -lm;

# ccd to mama conversion routine
ccd2mama:
    gcc ccd2mama.c -o $(OUTDIR)/ccd2mama -lm;

#ccd autocorrelation routine
stccdacr:
    gcc ccdacr.c -o $(OUTDIR)/ccdacr $(SUBS)/fourn.c -lm;

#Joe's ccd autocorrelation routine
jccdacr:
    gcc jccdacr.c -o $(OUTDIR)/jccdacr $(SUBS)/fourn.c -lm;

#emccd autocorrelation routine
emccdacr:
    gcc emccdacr.c -o $(OUTDIR)/emccdacr $(SUBS)/fourn.c -lm;

#ccd autocorrelation routine
ccdacrold:
    gcc ccdacrold.c -o $(OUTDIR)/ccdacrold $(SUBS)/fourn.c -lm;

#ccd integration routine
ccdint:
    gcc ccdint.c -o $(OUTDIR)/ccdint $(SUBS)/fourn.c -lm;

#ccd autocorrelation routine
ccdacr_octavi:
    gcc ccdacr_octavi.c -o $(OUTDIR)/ccdacr_octavi $(SUBS)/fourn.c -lm;

#ccd autocorrelation routine
ccdsaa:
    gcc ccdsaa.c -o $(OUTDIR)/ccdsaa $(SUBS)/fourn.c -lm;

#test ccd autocorrelation routine (for improvements, debugging)
tccdacr:
    gcc tccdacr.c -o $(OUTDIR)/tccdacr $(SUBS)/fourn.c -lm;

#ccd autocorrelation routine w/o correction for shutterless frame transfer
simccdacr:
    gcc simccdacr.c -o $(OUTDIR)/simccdacr $(SUBS)/fourn.c -lm;

#ccd bispectrum routine
ccdbsp:
    gcc ccdbsp.c -o $(OUTDIR)/ccdbsp $(SUBS)/fourn.c -lm;

#ccd bispectrum routine
ccdbspold:
    gcc ccdbspold.c -o $(OUTDIR)/ccdbspold $(SUBS)/fourn.c -lm;

#ccd image integration routine
ccdttrd:
    gcc ccdttrd.c -o $(OUTDIR)/ccdttrd $(SUBS)/fourn.c -lm;

#ccd power spectrum fitting routine
ccdpsfit:
    gcc ccdpsfit.c -o $(OUTDIR)/ccdpsfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;


#ccd power spectrum fitting routine
gccdpsfit:
    gcc gccdpsfit.c -o $(OUTDIR)/gccdpsfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#dispersion fitting program (variant of ccdpsfit)
dispfit:
    gcc dispfit.c -o $(OUTDIR)/dispfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#test ccd power spectrum fitting routine
tccdpsfit:
    gcc tccdpsfit.c -o $(OUTDIR)/tccdpsfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#ccd power spectrum fitting routine
ccdpsfitold:
    gcc ccdpsfitold.c -o $(OUTDIR)/ccdpsfitold $(SUBS)/fourn.c \
    $(SUBS)/nrutil.c $(SUBS)/amoeba.c -lm;

#ccd power spectrum fitting routine
dccdpsfit:
    gcc dccdpsfit.c -o $(OUTDIR)/dccdpsfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#fgs power spectrum fitting routine
fgspsfit:
    gcc fgspsfit.c -o $(OUTDIR)/fgspsfit $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#fgs power spectrum fitting routine
fgspsfit2:
    gcc fgspsfit2.c -o $(OUTDIR)/fgspsfit2 $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#fgs power spectrum fitting routine
fgspsfit3:
    gcc fgspsfit3.c -o $(OUTDIR)/fgspsfit3 $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#ccd speckle photometry fitting routine
sphotom:
    gcc sphotom.c -o $(OUTDIR)/sphotom $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#ccd modulus fitting routine
ccdmodfit:
    gcc ccdmodfit.c -o $(OUTDIR)/ccdmodfit $(SUBS)/fourn.c $(SUBS)/nrutil.c \
    $(SUBS)/amoeba.c -lm;

#channel saturation degradation program
chansat:
    cc chansat.c -o $(OUTDIR)/chansat $(SUBS)/postape.c \
    $(SUBS)/getframe0.c $(SUBS)/getframe1.c $(SUBS)/getat0.c \
    $(SUBS)/getat1.c $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#fixed frame centroiding routine
ctroid:
    gcc ctroid.c -o $(OUTDIR)/ctroid $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#2-dimensional cubic surface fitting routine
cubic:
    gcc cubic.c -o $(OUTDIR)/cubic $(SUBS)/amoeba.c $(SUBS)/nrutil.c -lm;

#fitting program for delta-m simulations
ddmfit:
    gcc ddmfit.c -o $(OUTDIR)/ddmfit $(SUBS)/amoeba.c $(SUBS)/nrutil.c -lm;
#fitting program for delta-m simulations
ddmfit2:
    gcc ddmfit2.c -o $(OUTDIR)/ddmfit2 $(SUBS)/amoeba.c $(SUBS)/nrutil.c -lm;


#flat fielded centroiding routine (test routine for Terry's platescale method)
ffctroid:
    gcc ffctroid.c -o $(OUTDIR)/ffctroid $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#2-dimensional Gaussian fitting routine
gfit2d:
    cc gfit2d.c -o $(OUTDIR)/gfit2d $(SUBS)/amoeba.c $(SUBS)/nrutil.c -lm;


#make integrated image from speckle file
mamattrd:
    gcc mamattrd.c -o $(OUTDIR)/mamattrd $(SUBS)/decode0.c \
    $(SUBS)/decode1.c -lm;

#make files for batch execution of osctroid, osacorr
mkalist:
    gcc mkalist.c -o $(OUTDIR)/mkalist;

#make files for batch execution of osctroid, osacorr, version can handle wosdva
mkalist2:
    gcc mkalist2.c -o $(OUTDIR)/mkalist2;

#make files for batch execution of point sources (SPIE-Hawaii sims)
mksimlist:
    gcc mksimlist.c -o $(OUTDIR)/mksimlist;

#make command file for simulation runs of binaries (delta-m sims)
mkbsimcmd:
    gcc mkbsimcmd.c -o $(OUTDIR)/mkbsimcmd -lm;

#make command file for simulation runs of binaries (delta-m sims)
mmkbsimcmd:
    gcc mmkbsimcmd.c -o $(OUTDIR)/mmkbsimcmd -lm;

#make .tab file for simulation runs of binaries (delta-m sims)
mksimflist:
    gcc mksimflist.c -o $(OUTDIR)/mksimflist -lm;

#make rough list of analyzed objects
mkrlist1:
    gcc mkrlist1.c -o $(OUTDIR)/mkrlist1 -lm;

#make .rlist file from a .rlist0 file of analyzed objects
mkrlist:
    gcc mkrlist.c -o $(OUTDIR)/mkrlist -lm;

#make .rlist0 file from a list of fits files (CCD data only)
mkrlist0:
    gcc mkrlist0.c -o $(OUTDIR)/mkrlist0 -lm;

#make final list of measures in CHARA 3rd Cat format
mkflist:
    gcc mkflist.c -o $(OUTDIR)/mkflist -lm;

#make final list of measures (SIM observations)
mkflist_sim:
    gcc mkflist_sim.c -o $(OUTDIR)/mkflist_sim -lm;

#make final list of measures in CHARA 3rd Cat format
mkflistf:
    gcc mkflistf.c -o $(OUTDIR)/mkflistf -lm;

#make final list of measures in CHARA 3rd Cat format (Brian's version)
mkflistwds:
    gcc mkflistwds.c -o $(OUTDIR)/mkflistwds -lm;

#make final list of photometry measures in CHARA 3rd Cat format
mkpflist:
    gcc mkpflist.c -o $(OUTDIR)/mkpflist -lm;

#make .cmd file for sphotom.c
mkspcmd:
    gcc mkspcmd.c -o $(OUTDIR)/mkspcmd -lm;

#make flist for seeing; includes failed measures
seeing:
    gcc seeing.c -o $(OUTDIR)/seeing -lm;

#make final list of measures in CHARA 3rd Cat format, small tel. version
lmkflist:
    gcc lmkflist.c -o $(OUTDIR)/lmkflist -lm;

#make final table of measures in table format
mkftab:
    gcc mkftab.c -o $(OUTDIR)/mkftab -lm;

#make final table of measures in table format (Photometry)
mkpftab:
    gcc mkpftab.c -o $(OUTDIR)/mkpftab -lm;

#make final table of measures in table format (Photometry)
mkpftab2:
    gcc mkpftab2.c -o $(OUTDIR)/mkpftab2 -lm;

#Tad's make final table of measures in table format w/ HIP data
mkftabdh:
    gcc mkftabdh.c -o $(OUTDIR)/mkftabdh -lm;

#make detectability table
dettab:
    gcc dettab.c -o $(OUTDIR)/dettab -lm;

#make shell script file for reducing acorrs to a final list of measures
mkmcmd:
    gcc mkmcmd.c -o $(OUTDIR)/mkmcmd;

#make modulus files for use with relphase
mkmod:
    cc mkmod.c -o $(OUTDIR)/mkmod $(SUBS)/fourn.c $(SUBS)/nrutil.c -lm

#oversampled frame autocorrelation routine
osacorr:
    gcc osacorr.c -o $(OUTDIR)/osacorr $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#oversampled frame autocorrelation routine for x5 mag (converts to low res)
osacorrx5:
    cc osacorrx5.c -o $(OUTDIR)/osacorrx5 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#oversampled frame bispectrum routine
osbispec:
    gcc osbispec.c -o $(OUTDIR)/osbispec $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c $(SUBS)/aalloc.c \
    $(SUBS)/fourn.c -lm;

#oversampled frame centroiding routine
osctroid:
    gcc osctroid.c -o $(OUTDIR)/osctroid $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#oversampled frame centroiding routine, flat fielding version
ffosctroid:
    gcc ffosctroid.c -o $(OUTDIR)/ffosctroid $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#oversampled frame directed vector autocorrelation routine
osdva:
    gcc osdva.c -o $(OUTDIR)/osdva $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

osdva3:
    cc osdva3.c -o $(OUTDIR)/osdva3 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

# merging routine for observing prelists
premerge:
    gcc premerge.c -o $(OUTDIR)/premerge

# merging routine for .flist files
mergeflist:
    gcc mergeflist.c -o $(OUTDIR)/mergeflist

# merging routine for .tab files (new [photometry] format)
mergepftab:
    gcc mergepftab.c -o $(OUTDIR)/mergepftab

# merging routine for .tab files (new [photometry] format)
mergepftab2:
    gcc mergepftab2.c -o $(OUTDIR)/mergepftab2

# merging routine for observing prelists
mergeflist_sim:
    gcc mergeflist_sim.c -o $(OUTDIR)/mergeflist_sim

# wiyn oversampled frame directed vector autocorrelation routine
wosdva:
    gcc wosdva.c -o $(OUTDIR)/wosdva $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

# wiyn oversampled frame directed vector autocorrelation routine 2
wosdva2:
    gcc wosdva2.c -o $(OUTDIR)/wosdva2 $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

ostest:
    cc test.c -o $(OUTDIR)/ostest $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#peak finding routine for autocorrelation functions
peakdet:
    cc peakdet.c -o $(OUTDIR)/peakdet -lm;
peakdet2:
    cc peakdet2.c -o $(OUTDIR)/peakdet2 -lm;

#power spectrum fitting program
psfit:
    cc psfit.c -o $(OUTDIR)/psfit $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/nrutil.c -lm; 

#power spectrum fitting program (standard version as of june 1997)
ospsfit:
    gcc ospsfit.c -o $(OUTDIR)/ospsfit $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/gaussj.c $(SUBS)/nrutil.c -lm; 
#improved version
ospsfit2:
    cc ospsfit2.c -o $(OUTDIR)/ospsfit2 $(SUBS)/fourn.c $(SUBS)/amoeba.c \
    $(SUBS)/gaussj.c $(SUBS)/nrutil.c -lm; 
ospsfit2old:
    cc ospsfit2old.c -o $(OUTDIR)/ospsfit2old $(SUBS)/fourn.c \
    $(SUBS)/amoeba.c \
    $(SUBS)/gaussj.c $(SUBS)/nrutil.c -lm; 
#recursive method phase reconstructor (based on John Heanue's 'phasen.c')
recphase:
    cc recphase.c -lm -o $(OUTDIR)/recphase;

#relaxation (and/or recursion) method phase reconstructor
relphaseold:
    cc relphaseold.c -o $(OUTDIR)/relphaseold -lm;

relphase:
    gcc relphase.c -o $(OUTDIR)/relphase $(SUBS)/fourn.c -lm;

relphase2:
    cc relphase2.c -o $(OUTDIR)/relphase2 $(SUBS)/fourn.c -lm;

krelphase:
    cc krelphase.c -o $(OUTDIR)/krelphase $(SUBS)/fourn.c -lm;

#(masked) running window autocorrelation routine
rwacorr:
    cc rwacorr.c -o $(OUTDIR)/rwacorr $(SUBS)/postape.c \
    $(SUBS)/getdata0.c $(SUBS)/getdata1.c $(SUBS)/getat0.c \
    $(SUBS)/getat1.c $(SUBS)/decode0.c $(SUBS)/decode1.c -lm;

#(masked) running window bispectrum routine
rwbispec:
    cc rwbispec.c -o $(OUTDIR)/rwbispec $(SUBS)/postape.c \
    $(SUBS)/getdata0.c $(SUBS)/getdata1.c $(SUBS)/getat0.c \
    $(SUBS)/getat1.c $(SUBS)/decode0.c $(SUBS)/decode1.c \
    $(SUBS)/aalloc.c $(SUBS)/putf.c $(SUBS)/fourn.c -lm;

#fixed frame centroid-and-add
shiftnadd:
    gcc shiftnadd.c -o $(OUTDIR)/shiftnadd $(SUBS)/postape.c \
    $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

#speckle data simulation routine
spsim:
    cc spsim.c -o $(OUTDIR)/spsim $(SUBS)/fourn.c -lm;
tspsim:
    gcc tspsim.c -o $(OUTDIR)/tspsim $(SUBS)/fourn.c -lm;
spsimbig:
    cc spsimbig.c -o $(OUTDIR)/spsimbig $(SUBS)/fourn.c -lm;

#ccd speckle data simulation routine
ccdspsim:
    gcc ccdspsim.c -o $(OUTDIR)/ccdspsim $(SUBS)/fourn.c -lm;

#ccd speckle data simulation routine
isospsim:
    gcc isospsim.c -o $(OUTDIR)/isospsim $(SUBS)/fourn.c -lm;

#ccd speckle data simulation routine w/ microchannel saturation
mccdspsim:
    gcc mccdspsim.c -o $(OUTDIR)/mccdspsim $(SUBS)/fourn.c -lm;

bccdspsim:
    cc bccdspsim.c -o $(OUTDIR)/bccdspsim $(SUBS)/fourn.c -lm;
#Frequency space signal-to-noise estimator
s2n:
    gcc s2n.c -o $(OUTDIR)/s2n -lm;

#speckle frame integration routine
spint:
    cc spint.c -o $(OUTDIR)/spint $(SUBS)/postape.c $(SUBS)/getframe0.c \
    $(SUBS)/getframe1.c $(SUBS)/getat0.c $(SUBS)/getat1.c \
    $(SUBS)/decode0.c $(SUBS)/decode1.c  -lm;

# PMIS header reader
rdpmishdr:
    cc rdpmishdr.c -o $(OUTDIR)/rdpmishdr;

# integrate fake speckle data frames
ztrans:
    cc ztrans.c -o $(OUTDIR)/ztrans -lm;


# "To do" List....


cpmamatp:
    cc cpmamatp.c -o $(OUTDIR)/cpmamatp $(SUBS);

cshift:
    cc cshift.c -o $(ZLIB)/cshift.X -lzproc -lm;

gaufit:
    cc gaufit.c -o $(ZLIB)/gaufit.X -I$(NR) -I$(NRU) -I$(IZ) $(NRSUBS) \
    -lzproc -lm;

gaulfit:
    cc gaulfit.c -o $(ZLIB)/gaulfit.X -I$(NR) -I$(NRU) -I$(IZ) $(NRSUBS) \
    -lzproc -lm;

gauss:
    cc gauss.c -o $(ZLIB)/tgauss.X -I$(IZ) $(SUBS) -lzprocx -lm;

radial:
    cc radial.c -o $(ZLIB)/radial.X -I$(IZ) -lzproc -lm;

recombine:
    cc recombine.c -o $(ZLIB)/recombine.X -I$(IZ) $(SUBS) -lzdump -lzproc;

shrink:
    cc shrink.c -o $(OUTDIR)/shrink $(SUBS) $(NRSUBS) -lzdump -lm;

thist:
    cc thist.c -o $(OUTDIR)/thist $(SUBS) $(NRSUBS) -lzdump -lm;


#FORTRAN ROUTINES--------------------------------------------------------

#extraction program for Washington Double Star Catalog
extractwds:
    f77 extractwds.f -o $(OUTDIR)/extractwds;

#extraction program for Hipparcos Catalog
xhip:
    gfortran xhip.f -o $(OUTDIR)/xhip;

#extraction program for Hipparcos Catalog, suspected objects
xhips:
    f77 xhips.f -o $(OUTDIR)/xhips;

#extraction program for Hipparcos Catalog
xhip3:
    gfortran xhip3.f -o $(OUTDIR)/xhip3;

#extraction program for Hipparcos Catalog
xhip_ctio:
    gfortran xhip_ctio.f -o $(OUTDIR)/xhip_ctio;

#extraction program for Hipparcos Catalog
nstars:
    gfortran nstars.f -o $(OUTDIR)/nstars;

#extraction program for SIM candidate grid stars from the USNO list
xsim:
    gfortran xsim.f -o $(OUTDIR)/xsim;
#extraction program for WDS
xwds:
    gfortran xwds.f -o $(OUTDIR)/xwds;
#extraction program for WDS
xwds2:
    gfortran xwds2.f -o $(OUTDIR)/xwds2;

#extraction program for WDS
xusno:
    gfortrans xusno.f -o $(OUTDIR)/xusno;

#old extraction program for Yale Bright Star Catalog (version 5) single object
extractbsc:
    f77 extractbsc.f -o $(OUTDIR)/extractbsc;
#old extraction program for Yale Bright Star Catalog (version 5) final obslist
extractbsc2:
    f77 extractbsc2.f -o $(OUTDIR)/extractbsc2;
#old extraction program for Yale Bright Star Catalog (version 5) wiyn format
extractbsc3:
    f77 extractbsc3.f -o $(OUTDIR)/extractbsc3;
#new (11/98) extraction program for Yale Bright Star Catalog (version 5)
xbsc:
    gfortran xbsc.f -o $(OUTDIR)/xbsc;

#program to fit slit mask files with Terry's optmask routine
optmask3:
    f77 optmask3.f -o $(OUTDIR)/optmask3;

#program to fit slit mask files with Terry's optmask routine
# use this version for aliased lines
optmask3a:
    f77 optmask3a.f -o $(OUTDIR)/optmask3a;

#program to fit slit mask files with Terry's optmask routine
# use this version for CASLEO data
optmask3c:
    f77 optmask3c.f -o $(OUTDIR)/optmask3c;

#program to fit star trail files with Terry's routine
trail:
    gfortran trail.f -o $(OUTDIR)/trail;

#program to convert Julian Date to Bessian Year
jd2by:
    gcc jd2by.c -lm -o $(OUTDIR)/jd2by;

# "official" version of Meridith's orbitfit2 program
orbitfit:
    gcc orbitfit.c -o $(OUTDIR)/orbitfit $(SUBS)/amoeba.c  \
        $(SUBS)/nrutil.c -lm;
# Indiv. errors version of Meridith's orbitfit2 program
orbitfiterr:
    gcc orbitfiterr.c -o $(OUTDIR)/orbitfiterr $(SUBS)/amoeba.c  \
        $(SUBS)/nrutil.c -lm;

最佳答案

您可能必须运行 make stccdacr,否则您应该更改规则

stccdacr:
    gcc ccdacr.c -o $(OUTDIR)/ccdacr $(SUBS)/fourn.c -lm;

ccdacr:
    gcc ccdacr.c -o $(OUTDIR)/ccdacr $(SUBS)/fourn.c -lm;

否则,将调用 make ccdacr 的默认规则,该规则对 -lm 一无所知。

关于c - Makefile 抛出 undefined reference 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35563199/

相关文章:

c++ - 使用 g++ 构建时如何抑制来自某些文件的警告?

makefile - 如何在Makefile中获取名称列表的笛卡尔积(组合扩展)

c - 如果我在 C 中不使用从零开始的数组会发生什么

c++ - 哪些 C/C++ 编译器可用于 VxWorks?

makefile - GNU 使 : Using the filter function in prerequisites

unix - 如何在 Makefile 中包含干净的目标?

c - 可加载内核模块错误 make : nothing to be done for all?

c - 两个结构的大小相同,尽管其中一个结构中有一个结构实例

c++ - 指向数组第一个元素的指针的地址?

c - rand() 仅返回零