简体   繁体   English

Makefile引发未定义的参考错误

[英]Makefile throwing undefined reference errors

I'm trying to run a Makefile to get a data-reduction pipeline working on my PC. 我正在尝试运行Makefile,以使数据减少管道在我的PC上正常工作。 My advisor built the pipeline, but he and I are currently 1000 miles from one another, so he is unable to help with this. 我的顾问建立了管道,但是我和他目前彼此相距1000英里,因此他无能为力。 Here is a snippet of my Makefile: 这是我的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; 

And then there are a whole bunch of lines just like the one directly above for all of the other .c files, all with -lm at the end. 然后有很多行,就像所有其他.c文件的上方一样,都以-lm结尾。

I'm getting the following errors when trying to run make: 尝试运行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

Does this have to do with where I have these files located? 这与这些文件的位置有关吗? Currently they reside in their own folder on my desktop. 目前,它们位于我的桌面上自己的文件夹中。 They are located in a subfolder of that directory called "programs." 它们位于该目录的子文件夹中,称为“程序”。

My apologies if this is all very vague; 如果这一切都很模糊,我深表歉意。 I'm not very good with C. 我对C不太好。

Edit: Here is the full Makefile. 编辑:这是完整的Makefile。 It's long. 它的长。

#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;

You probably have to run make stccdacr instead, or you should change the rule 您可能必须运行make stccdacr ,否则您应该更改规则

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

to

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

Otherwise a default rule will be invoked for make ccdacr which knows nothing about -lm . 否则,将对make ccdacr调用缺省规则,该规则对-lm一无所知。

The problem is that you are trying to build a target, ccdacr , for which there is no rule in the makefile. 问题是您正在尝试构建目标ccdacr ,该目标在makefile中没有规则。 Make knows how to build some things without being told, and it sees that you have a file ccdacr.c , so it uses its default rule for building things from C source files: Make知道如何构建某些东西而不会被告知,并且看到您有一个文件ccdacr.c ,因此它使用其默认规则从C源文件构建东西:

cc     ccdacr.c   -o ccdacr

This doesn't work because Make doesn't know that this source needs the math library. 这不起作用,因为Make不知道此源需要数学库。 You can add a rule to your makefile: 您可以将规则添加到您的makefile中:

ccdacr:
    cc ccdacr.c -o ccdacr -lm;

This might work, it might not, depending on whether ccdacr needs any other sources. 根据ccdacr是否需要任何其他来源,这可能有效,也可能无效 If it doesn't work, tell us the new error message and we'll go from there. 如果它不起作用,请告诉我们新的错误消息,然后我们将继续处理。

If it does work, I suspect you want the executable to go into ../bin/ , so we can modify the rule: 如果确实有效,我怀疑您希望可执行文件进入../bin/ ,因此我们可以修改规则:

ccdacr:
    cc ccdacr.c -o $(OUTDIR)/ccdacr -lm;

This will work, but it breaks an important rule of makefiles: the target should be the exact name of the file being built(*). 这会起作用,但是会破坏makefile的一条重要规则:目标应该是要生成的文件的确切名称(*)。 So this is better: 所以这更好:

$(OUTDIR)/ccdacr:
    cc ccdacr.c -o $(OUTDIR)/ccdacr -lm;

This is just the beginning. 这仅仅是开始。 This makefile can be cleaned up and simplified a lot , but for now let's just get it working. 这个makefile可以被清理和简化很多 ,但是现在让我们开始吧。

(*) This applies only to non-PHONY targets. (*)仅适用于非PHONY目标。

EDIT: The first warning is about line 349 in ccdacr.c : 编辑:第一个警告是关于ccdacr.c的第349 ccdacr.c

printf("Read in FITS header. %d\n",sizeof(char));

You should change the %d to %zu (and if that doesn't work, try %lu ) as @user3386109 suggested. 您应按照@ user3386109的建议将%d更改为%zu (如果不起作用,请尝试%lu )。

The error messages indicate that ccdacr needs code from another source, almost certainly fourn.c , so we change the rule: 错误消息表明ccdacr需要来自另一个来源的代码,几乎可以肯定是fourn.c ,因此我们更改了规则:

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

Give this a try. 试试看。 If it works, we can still make it better. 如果可行,我们仍然可以做得更好。 Are you familiar with the concept of object files ? 您熟悉对象文件的概念吗? The idea is that instead of turning source files directly into an executable binary: 这个想法是,与其将源文件直接转换成可执行二进制文件,不如:

foo.c + bar.c => thing

the compiler builds a binary file for each source file, then links them together: 编译器为每个源文件构建一个二进制文件,然后将它们链接在一起:

foo.c => foo.o
bar.c => bar.o
foo.o + bar.o => thing

One advantage of this approach is that if many executables use one source file, that file need not be recompiled every time one of the executables must be rebuilt. 这种方法的一个优点是,如果许多可执行文件使用一个源文件,则不必在每次必须重建一个可执行文件时都重新编译该文件。 This can speed the build process up quite a lot. 这可以大大加快构建过程。 If you're interested, we can start using this approach and putting the obejct files in bin/ . 如果您有兴趣,我们可以开始使用这种方法并将obejct文件放入bin/ And whether or not you want to use object files, once the new rule is working we can make it (and the old ones) much cleaner. 不管您是否要使用目标文件,一旦新规则生效,我们就可以使它(和旧规则)变得更加整洁。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM