当前位置: 技术问答>linux和unix
[跪求牛人!!!!!]:sdl_mixer静态编译问题?
来源: 互联网 发布时间:2016-08-08
本文导语: sdl_mixer是sdl中关于音频播放的扩展库,我基于sdl_mixer写了个程序,程序试过了,是没有问题的。我在虚拟机linux下重新安装sdl_mixer,希望把它这个软件包编译成纯静态的。然后再编译我的程序,结果就出问题了。步骤...
sdl_mixer是sdl中关于音频播放的扩展库,我基于sdl_mixer写了个程序,程序试过了,是没有问题的。我在虚拟机linux下重新安装sdl_mixer,希望把它这个软件包编译成纯静态的。然后再编译我的程序,结果就出问题了。步骤如下:
1、从网下下载SDL_mixer-1.2.8.tar.tar包。
2、解压后,在SDL_mixer-1.2.8/目录下,./configure --prefix=/usr/local --enable-shared=no --enable-static=yes,然后make clean ,然后make,再然后make install。此时在/usr/local/lib目录下产生了该软件包的静态库。
/usr/local/lib # ls
directfb-1.0-0 libdirect.a libdirect.la libfusion.a libiconv.la libSDL_image.la libSDL_mixer.a preloadable_libiconv.so libcharset.a libdirectfb.a libfreetype.a libfusion.la libSDL.a libSDL.la libSDL_mixer.la libcharset.la libdirectfb.la libfreetype.la libiconv.a libSDL_image.a libSDLmain.a pkgconfig
3、回到我程序的主目录,编译我的程序,结果出了一堆错误:
# make
g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.3.2/lib -o qt_sdl_music main.o QMusicpl ayer.o QPlaythread.o moc_QMusicplayer.o moc_QPlaythread.o -L/usr/local/Trollt ech/Qt-4.3.2/lib -L/usr/local/lib -lSDL -lSDLmain -lGL -lSDL_mixer -lQtGui -L/us r/local/Trolltech/Qt-4.3.2/lib -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQt Core -lz -lm -lrt -ldl -lpthread
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `mix_channels':
mixer.c:(.text+0x18b): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x624): undefined reference to `SDL_MixAudio'
mixer.c:(.text+0x80d): undefined reference to `SDL_MixAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_OpenAudio':
mixer.c:(.text+0xb15): undefined reference to `SDL_OpenAudio'
mixer.c:(.text+0xb3a): undefined reference to `SDL_CloseAudio'
mixer.c:(.text+0xd1e): undefined reference to `SDL_PauseAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_AllocateChannels':
mixer.c:(.text+0xd88): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0xf51): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_LoadWAV_RW':
mixer.c:(.text+0x1064): undefined reference to `SDL_ReadLE32'
mixer.c:(.text+0x1100): undefined reference to `SDL_LoadWAV_RW'
mixer.c:(.text+0x11f5): undefined reference to `SDL_BuildAudioCVT'
mixer.c:(.text+0x1207): undefined reference to `SDL_FreeWAV'
mixer.c:(.text+0x128c): undefined reference to `SDL_FreeWAV'
mixer.c:(.text+0x12ca): undefined reference to `SDL_FreeWAV'
mixer.c:(.text+0x12d8): undefined reference to `SDL_ConvertAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_FreeChunk':
mixer.c:(.text+0x14ef): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x155c): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_SetPostMix':
mixer.c:(.text+0x158b): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x15a0): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_HookMusic':
mixer.c:(.text+0x15ad): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x15de): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_ChannelFinished':
mixer.c:(.text+0x15f5): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x1602): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_PlayChannelTimed':
mixer.c:(.text+0x16e6): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x175c): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x18b7): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_ExpireChannel':
mixer.c:(.text+0x1912): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x193c): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x195d): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_FadeInChannelTimed':
mixer.c:(.text+0x19aa): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x1a14): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x1c18): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_HaltChannel':
mixer.c:(.text+0x1d49): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x1e4d): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_FadeOutChannel':
mixer.c:(.text+0x1eff): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x2020): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x202c): undefined reference to `SDL_UnlockAudio'
1、从网下下载SDL_mixer-1.2.8.tar.tar包。
2、解压后,在SDL_mixer-1.2.8/目录下,./configure --prefix=/usr/local --enable-shared=no --enable-static=yes,然后make clean ,然后make,再然后make install。此时在/usr/local/lib目录下产生了该软件包的静态库。
/usr/local/lib # ls
directfb-1.0-0 libdirect.a libdirect.la libfusion.a libiconv.la libSDL_image.la libSDL_mixer.a preloadable_libiconv.so libcharset.a libdirectfb.a libfreetype.a libfusion.la libSDL.a libSDL.la libSDL_mixer.la libcharset.la libdirectfb.la libfreetype.la libiconv.a libSDL_image.a libSDLmain.a pkgconfig
3、回到我程序的主目录,编译我的程序,结果出了一堆错误:
# make
g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.3.2/lib -o qt_sdl_music main.o QMusicpl ayer.o QPlaythread.o moc_QMusicplayer.o moc_QPlaythread.o -L/usr/local/Trollt ech/Qt-4.3.2/lib -L/usr/local/lib -lSDL -lSDLmain -lGL -lSDL_mixer -lQtGui -L/us r/local/Trolltech/Qt-4.3.2/lib -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQt Core -lz -lm -lrt -ldl -lpthread
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `mix_channels':
mixer.c:(.text+0x18b): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x624): undefined reference to `SDL_MixAudio'
mixer.c:(.text+0x80d): undefined reference to `SDL_MixAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_OpenAudio':
mixer.c:(.text+0xb15): undefined reference to `SDL_OpenAudio'
mixer.c:(.text+0xb3a): undefined reference to `SDL_CloseAudio'
mixer.c:(.text+0xd1e): undefined reference to `SDL_PauseAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_AllocateChannels':
mixer.c:(.text+0xd88): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0xf51): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_LoadWAV_RW':
mixer.c:(.text+0x1064): undefined reference to `SDL_ReadLE32'
mixer.c:(.text+0x1100): undefined reference to `SDL_LoadWAV_RW'
mixer.c:(.text+0x11f5): undefined reference to `SDL_BuildAudioCVT'
mixer.c:(.text+0x1207): undefined reference to `SDL_FreeWAV'
mixer.c:(.text+0x128c): undefined reference to `SDL_FreeWAV'
mixer.c:(.text+0x12ca): undefined reference to `SDL_FreeWAV'
mixer.c:(.text+0x12d8): undefined reference to `SDL_ConvertAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_FreeChunk':
mixer.c:(.text+0x14ef): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x155c): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_SetPostMix':
mixer.c:(.text+0x158b): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x15a0): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_HookMusic':
mixer.c:(.text+0x15ad): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x15de): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_ChannelFinished':
mixer.c:(.text+0x15f5): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x1602): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_PlayChannelTimed':
mixer.c:(.text+0x16e6): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x175c): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x18b7): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_ExpireChannel':
mixer.c:(.text+0x1912): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x193c): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x195d): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_FadeInChannelTimed':
mixer.c:(.text+0x19aa): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x1a14): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x1c18): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_HaltChannel':
mixer.c:(.text+0x1d49): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x1e4d): undefined reference to `SDL_UnlockAudio'
/usr/local/lib/libSDL_mixer.a(mixer.o): In function `Mix_FadeOutChannel':
mixer.c:(.text+0x1eff): undefined reference to `SDL_LockAudio'
mixer.c:(.text+0x2020): undefined reference to `SDL_GetTicks'
mixer.c:(.text+0x202c): undefined reference to `SDL_UnlockAudio'
|
LIBS += -L/usr/local/lib -I/usr/local/include/SDL /usr/local/lib/libSDL.a /usr/local/lib/libSDLmain.a /usr/local/lib/libSDL_mixer.a
把这句改成:
LIBS += -L/usr/local/lib -I/usr/local/include/SDL /usr/local/lib/libSDL_mixer.a /usr/local/lib/libSDL.a /usr/local/lib/libSDLmain.a
把这句改成:
LIBS += -L/usr/local/lib -I/usr/local/include/SDL /usr/local/lib/libSDL_mixer.a /usr/local/lib/libSDL.a /usr/local/lib/libSDLmain.a
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。