Hey everyone, I'm trying to develop my first game with SFML and everything is going fine so far. Now, I wanted to add the first sound effects, but Im not able to get it running. Somehow, it is not working for me. I created a new hello world project, but also in this project the program crashes.
From this page
https://www.sfml-dev.org/download/sfml/2.5.1/ I downloaded "GCC 7.3.0 MinGW (DW2) - 32-bit" and also the linked GCC compiler (
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.3.0/threads-posix/dwarf/i686-7.3.0-release-posix-dwarf-rt_v5-rev0.7z/download). So the toolchain setup should be okay, also everything else (regarding game's graphic animations) is running fine.
Here my main.cpp:
//main.cpp
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
// !! just by adding this sound object the program crashes !!
// when I remove the line the "hello world" sfml app runs fine
sf::Sound sound;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
Here my CMakeLists.txt:
cmake_minimum_required(VERSION 3.11)
project(untitled1)
add_executable(untitled1 main.cpp)
set(SFML_STATIC_LIBRARIES TRUE)
set(SFML_DIR "C:/Users/Maximilian/Documents/Projects/toolchain/SFML-2.5.1/lib/cmake/SFML")
find_package(SFML 2.5 COMPONENTS audio graphics window system REQUIRED)
target_link_libraries(untitled1 sfml-graphics sfml-audio)
When I run the program I directly get:
Process finished with exit code -1073741515 (0xC0000135)
I'm using windows 10 and clion as IDE.
So, Im kinda stuck now and do not know how to proceed. Can anyone help me here? Am I missing some linking in the cmake? I tried to search the forum, but did not find anything on this. Any help is appreciated