SFML community forums

Help => Audio => Topic started by: LinasNikis on June 07, 2015, 05:29:14 pm

Title: undefined reference to `vorbis..'
Post by: LinasNikis on June 07, 2015, 05:29:14 pm
I'm using C::B, sfml 2.3 GCC 4.7.1 TDM (SJLJ) - 32-bit, GNU GCC Compiler 4.7.1. When i try to compile this code:
#include <SFML/Audio.hpp>

int main()
{
    sf::Sound sound;
    return 0;
}
 
It gives me these errors:
||=== Build: Debug in Mars(compiler: GNU GCC Compiler) ===|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_packet_blocksize'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_packet_blocksize'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_packet_blocksize'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_trackonly'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
D:\Downloads\Programs\GAMES\DEVELOPMENT\SFML-2.3\lib\libvorbisfile.a(vorbisfile.o):vorbisfile.c|| undefined reference to `vorbis_synthesis_halfrate_p'|
||=== Build failed: 18 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
 
I don't know what is the cause of this.
Sorry for bad english.
Please help.
Title: Re: undefined reference to `vorbis..'
Post by: Jesper Juhl on June 07, 2015, 05:34:43 pm
Are you linking sfml statically? In that case, are you remembering to link all the dependencies explicitly (and in the correct order)?
Read this (all of it! and especially all the red boxes): http://www.sfml-dev.org/tutorials/2.3/start-cb.php
Title: Re: undefined reference to `vorbis..'
Post by: LinasNikis on June 07, 2015, 07:15:59 pm
Yes I'm linking statically.
My configuration for debug is:
sfml-graphics-s-d
sfml-window-s-d
sfml-audio-s-d
sfml-network-s-d
sfml-system-s-d
opengl32
freetype
jpeg
winmm
gdi32
openal32
flac
vorbis
vorbisenc
vorbisfile
ogg
ws2_32
 
Title: Re: undefined reference to `vorbis..'
Post by: LinasNikis on June 09, 2015, 04:08:00 pm
Okay. That's weird. If i link dynamically then everything works. Any ideas?
Title: Re: undefined reference to `vorbis..'
Post by: Laurent on June 09, 2015, 04:26:58 pm
Try to put vorbis after vorbisfile and vorbisenc in the list.
Title: Re: undefined reference to `vorbis..'
Post by: LinasNikis on June 09, 2015, 04:50:06 pm
Thank you Laurent. It works now. But on official tutorial for C::B sfml 2.3
(http://www.sfml-dev.org/tutorials/2.3/start-cb.php (http://www.sfml-dev.org/tutorials/2.3/start-cb.php))
vorbis is before vorbisfile and vorbisenc. Thank you!