I have sfml installed to my codeblocks, and the graphics part has been working great. I'm following some youtube tutorials that just covered audio, yet when I try running the code that I am taught, I get a ton of errors. I've spent so many hours looking for a solution to this; I REALLY need some help right now and would appreciate anything
Here's my code:
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <string>
#include <iostream>
int main(){ //IMPORTANT: use .wav files for sound effects, and use .ogg files for long background songs etc.
sf::Vector2i screenDimensions(800,600);
sf::RenderWindow Window;
Window.create(sf::VideoMode(screenDimensions.x, screenDimensions.y), "A Window");
sf::Clock clock;
sf::SoundBuffer soundBuffer;
sf::Sound sound;
if(!soundBuffer.loadFromFile("punch.ogg")){
std::cout << "Can't find audio file" << std::endl;
}
sound.setBuffer(soundBuffer);
float moveSpeed = 10000.0f;
while(Window.isOpen()){
clock.restart();
sf::Event Event;
while(Window.pollEvent(Event)){
switch(Event.type){
case sf::Event::Closed:
Window.close();
break;
case sf::Event::KeyPressed:
if(Event.key.code == sf::Keyboard::Escape){
Window.close();
}
if(Event.key.code == sf::Keyboard:
){
sound.play(); //there's also sound.pause(), that is resumed with play(), but also sound.stop() that resets the sound when next played
}
break;
}
}
Window.display();
Window.clear();
}
}
Here's all of the linker settings (I've done the #define's and the other stuff so I don't think the issue could actually be that)
sfml-audio-s-d
sfml-network-s-d
sfml-graphics-s-d
sfml-window-s-d
sfml-system-s-d
flac
ogg
vorbis
vorbisenc
vorbisfile
openal32
jpeg
freetype
ws2_32
gdi32
opengl32
winmm
And lastly, all of the wonderful errors:
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| more undefined references to `oggpack_write' follow|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_readinit'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_readinit'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| more undefined references to `oggpack_read' follow|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| more undefined references to `oggpack_read' follow|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_writeinit'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_writeclear'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_writeclear'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_writeinit'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| more undefined references to `oggpack_write' follow|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_reset'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_writeclear'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_reset'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
E:\CODING STUFF FOR C++\zzz.External Libraries\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 2 seconds) ===|