gpt4 book ai didi

c++ - 为什么我在安装软件包时收到这样的错误消息?

转载 作者:行者123 更新时间:2023-11-30 19:44:32 28 4
gpt4 key购买 nike

我目前运行的是 Ubuntu 12.04。我正在寻找安装This Package .
我已经安装了软件包:'fftw2','fftw-dev','fftw-doc','fftw-3.3.4'

但是,当我尝试 root@ubuntu:~/spectrum-master# make 时:

cc -lm -lasound -L/usr/lib/x86_64-linux-gnu -lSDL -lfftw3f -lm spectrum.o mmap_file.o pcm.o wav.o alsa.o window.o stft.o cqt.o trans.o -o spectrum
spectrum.o: In function handle_events': /home/userKum/spectrum-master/spectrum.c:27: undefined reference toSDL_PollEvent'
spectrum.o: In function srgb': /home/userKum/spectrum-master/spectrum.c:78: undefined reference to__powf_finite'
/home/userKum/spectrum-master/spectrum.c:76: undefined reference to __powf_finite' /home/userKum/spectrum-master/spectrum.c:77: undefined reference to__powf_finite'
spectrum.o: In function main': /home/userKum/spectrum-master/spectrum.c:126: undefined reference toSDL_Init'
/home/userKum/spectrum-master/spectrum.c:127: undefined reference to SDL_SetVideoMode' /home/userKum/spectrum-master/spectrum.c:143: undefined reference toSDL_WM_SetCaption'
/home/userKum/spectrum-master/spectrum.c:144: undefined reference to SDL_EnableKeyRepeat' /home/userKum/spectrum-master/spectrum.c:199: undefined reference to__log10f_finite'
/home/userKum/spectrum-master/spectrum.c:157: undefined reference to SDL_Flip' /home/userKum/spectrum-master/spectrum.c:158: undefined reference toSDL_Delay'
alsa.o: In function write_alsa': /home/userKum/spectrum-master/alsa.c:71: undefined reference tosnd_pcm_writei'
/home/userKum/spectrum-master/alsa.c:72: undefined reference to snd_pcm_prepare' alsa.o: In functionread_alsa':
/home/userKum/spectrum-master/alsa.c:54: undefined reference to snd_pcm_readi' /home/userKum/spectrum-master/alsa.c:55: undefined reference tosnd_pcm_prepare'
alsa.o: In function close_alsa': /home/userKum/spectrum-master/alsa.c:26: undefined reference tosnd_pcm_drain'
/home/userKum/spectrum-master/alsa.c:27: undefined reference to snd_pcm_close' alsa.o: In functionopen_alsa_read':
/home/userKum/spectrum-master/alsa.c:92: undefined reference to snd_pcm_hw_params_sizeof' /home/userKum/spectrum-master/alsa.c:92: undefined reference tosnd_pcm_hw_params_sizeof'
/home/userKum/spectrum-master/alsa.c:94: undefined reference to snd_pcm_open' /home/userKum/spectrum-master/alsa.c:100: undefined reference tosnd_pcm_hw_params_any'
/home/userKum/spectrum-master/alsa.c:107: undefined reference to snd_pcm_hw_params_set_access' /home/userKum/spectrum-master/alsa.c:114: undefined reference tosnd_pcm_hw_params_set_format'
/home/userKum/spectrum-master/alsa.c:121: undefined reference to snd_pcm_hw_params_set_rate_resample' /home/userKum/spectrum-master/alsa.c:130: undefined reference tosnd_pcm_hw_params_set_rate_min'
/home/userKum/spectrum-master/alsa.c:109: undefined reference to snd_pcm_close' /home/userKum/spectrum-master/alsa.c:137: undefined reference tosnd_pcm_hw_params'
/home/userKum/spectrum-master/alsa.c:144: undefined reference to snd_pcm_hw_params_get_rate' /home/userKum/spectrum-master/alsa.c:151: undefined reference tosnd_pcm_hw_params_get_channels'
alsa.o: In function open_alsa_write': /home/userKum/spectrum-master/alsa.c:177: undefined reference tosnd_pcm_hw_params_sizeof'
/home/userKum/spectrum-master/alsa.c:177: undefined reference to snd_pcm_hw_params_sizeof' /home/userKum/spectrum-master/alsa.c:179: undefined reference tosnd_pcm_open'
/home/userKum/spectrum-master/alsa.c:185: undefined reference to snd_pcm_hw_params_any' /home/userKum/spectrum-master/alsa.c:192: undefined reference tosnd_pcm_hw_params_set_access'
/home/userKum/spectrum-master/alsa.c:199: undefined reference to snd_pcm_hw_params_set_format' /home/userKum/spectrum-master/alsa.c:206: undefined reference tosnd_pcm_hw_params_set_rate_resample'
/home/userKum/spectrum-master/alsa.c:213: undefined reference to snd_pcm_hw_params_set_rate_near' /home/userKum/spectrum-master/alsa.c:218: undefined reference tosnd_pcm_hw_params_set_channels_near'
/home/userKum/spectrum-master/alsa.c:223: undefined reference to snd_pcm_hw_params' /home/userKum/spectrum-master/alsa.c:194: undefined reference tosnd_pcm_close'
window.o: In function sinc': /home/userKum/spectrum-master/window.c:14: undefined reference tosinf'
window.o: In function hann': /home/userKum/spectrum-master/window.c:24: undefined reference tocosf'
window.o: In function hamming': /home/userKum/spectrum-master/window.c:29: undefined reference tocosf'
window.o: In function sinc': /home/userKum/spectrum-master/window.c:14: undefined reference tosinf'
window.o: In function gauss': /home/userKum/spectrum-master/window.c:38: undefined reference to__expf_finite'
stft.o: In function free_stft': /home/userKum/spectrum-master/stft.c:44: undefined reference tofftwf_destroy_plan'
stft.o: In function get_stft': /home/userKum/spectrum-master/stft.c:38: undefined reference tocabsf'
stft.o: In function create_stft': /home/userKum/spectrum-master/stft.c:66: undefined reference tofftwf_plan_dft_r2c_1d'
stft.o: In function slide_stft': /home/userKum/spectrum-master/stft.c:31: undefined reference tofftwf_execute'
cqt.o: In function get_cqt': /home/userKum/spectrum-master/cqt.c:33: undefined reference tocabsf'
cqt.o: In function free_cqt': /home/userKum/spectrum-master/cqt.c:47: undefined reference tofftwf_destroy_plan'
cqt.o: In function create_cqt': /home/userKum/spectrum-master/cqt.c:65: undefined reference to__logf_finite'
/home/userKum/spectrum-master/cqt.c:65: undefined reference to __expf_finite' /home/userKum/spectrum-master/cqt.c:66: undefined reference to__log2_finite'
/home/userKum/spectrum-master/cqt.c:87: undefined reference to fftwf_plan_dft_1d' /home/userKum/spectrum-master/cqt.c:98: undefined reference tocexpf'
/home/userKum/spectrum-master/cqt.c:103: undefined reference to fftwf_execute' /home/userKum/spectrum-master/cqt.c:57: undefined reference tocabsf'
/home/userKum/spectrum-master/cqt.c:57: undefined reference to cabsf' /home/userKum/spectrum-master/cqt.c:115: undefined reference tocabsf'
/home/userKum/spectrum-master/cqt.c:117: undefined reference to cabsf' /home/userKum/spectrum-master/cqt.c:117: undefined reference tocabsf'
/home/userKum/spectrum-master/cqt.c:57: undefined reference to __powf_finite' /home/userKum/spectrum-master/cqt.c:139: undefined reference tofftwf_destroy_plan'
/home/userKum/spectrum-master/cqt.c:146: undefined reference to fftwf_plan_dft_r2c_1d' cqt.o: In functionslide_cqt':
/home/userKum/spectrum-master/cqt.c:30: undefined reference to `fftwf_execute'
collect2: ld returned 1 exit status
make: *** [spectrum] Error 1

我不知道这些 undefined reference 是怎么回事......看起来它在编译过程中缺少与'-lasound'的链接。我应该怎么做才能解决这个问题?

<小时/><小时/>

应部分观众要求,MakeFile如下:

CFLAGS = -g -D_GNU_SOURCE=1 -W -Wall -O3 -std=c99 -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fno-trapping-math -fcx-limited-range -fsingle-precision-constant $(shell sdl-config --cflags) $(shell pkg-config fftw3f --cflags)
LDFLAGS = -lm -lasound $(shell sdl-config --libs) $(shell pkg-config fftw3f --libs)

all: spectrum

clean:
rm -f spectrum *.o

spectrum: spectrum.o mmap_file.o pcm.o wav.o alsa.o window.o stft.o cqt.o trans.o

最佳答案

“库需要在对象之后”的另一个经典案例:

您的库,由以下定义

LDFLAGS = -lm -lasound $(shell sdl-config --libs) $(shell pkg-config fftw3f --libs)

鉴于(根据此处)链接规则是:

$(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS)

我希望这样

LDLIBS = -lm -lasound $(shell sdl-config --libs) $(shell pkg-config fftw3f --libs)

就可以了,尽管我更喜欢实际编写自己的链接器行,因为不可避免地我最终想确切地知道链接的内容......

(Unix 链接器在处理库时相当简单,因此如果您将 -lsomething x.o 列出到链接器,链接器将不会从 -lsomething 中获取任何内容,并提示 somethingFunc1 (可以在 libsomething.a 中找到)丢失,因为在 x.o 之后找不到它。

关于c++ - 为什么我在安装软件包时收到这样的错误消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28018601/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com