SFML community forums
Help => Audio => Topic started by: Syntactic Fructose on March 06, 2012, 08:30:47 pm
-
Cant seem to get SFML to work, im using Codeblocks compiler for C++.
I created a new SFML project using the wizard and was provided the following code(simple window).
#include <SFML/Graphics.hpp>
int main()
{
// Create the main window
sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");
// Load a sprite to display
sf::Image Image;
if (!Image.LoadFromFile("cb.bmp"))
return EXIT_FAILURE;
sf::Sprite Sprite(Image);
// Start the game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Clear screen
App.Clear();
// Draw the sprite
App.Draw(Sprite);
// Update the window
App.Display();
}
return EXIT_SUCCESS;
}
but upon running i get the error:
||=== Tester, Debug ===|
ld.exe||cannot find -lsfml-audio.dll|
||=== Build finished: 1 errors, 0 warnings ===|
Im not sure why though, because i clearly see the audio.dll file in the folder, and have the correct links. Any suggestions?
-
I created a new SFML project using the wizard
Bad idea, this wizard simply doesn't work.
Follow the official SFML tutorial if you want to get something working.
-
The DLL files are the files you give along with your program. What you need to link are ".a" files, in this case "libsfml-audio.a".
Also if you work on Windows, I suggest you static-link SMFL (linking "-s.a" files instead), it works better from my own experience :)
-
Also if you work on Windows, I suggest you static-link SMFL (linking "-s.a" files instead), it works better from my own experience
The dynamic version works exactly as good as the static one... :P
-
Also if you work on Windows, I suggest you static-link SMFL (linking "-s.a" files instead), it works better from my own experience
The dynamic version works exactly as good as the static one... :P
I once had a problem with GDB + Code::Blocks: Whenever I tried debugging, gdb.exe crashed. GDB did not crash when used directly in a terminal, only through C::B.
I was using the dynamic debug libraries of SFML2. The problem disappeared by using the static version instead (it was a while ago, but I think I found a clue to that answer on the French SFML forum, so I was apparently not the only one who got this) :)
-
so under build options how should i set up the list?
currently i use:
build options->release->linker settings->other linker options
-lsfml-audio-s
-lsfml-graphics
-lsfml-window
-lsfml-system
-
Er, personally I use "link libraries" and give a relative path to the libraries (less portable, but much easier for me to move my stuff, I'm the only one compiling it anyway).
Anyway if you want to use "other linker options", you list looks good to ME EXCEPT that you're mixing static and dynamic libraries. It should work, but that's a bit weird to do that :o
Use either:
-lsfml-audio-s
-lsfml-graphics-s
-lsfml-window-s
-lsfml-system-s
Or:
-lsfml-audio
-lsfml-graphics
-lsfml-window
-lsfml-system
Also if you use static libraries, don't forget to use "Compiler settings -> #defines" and write there:
SFML_STATIC
-
I am having this same problem to and I've tried some of the earlier posts solutions but they haven't work for me can some post a step by step way to do it?
-
There are multiple step-by-step tutorials on the website, and I can ensure you they are correct. Just be sure to read everything and follow them to the letter :)
Sorry we can't really help you much more than this, the process is really straightforward, you must have made a mistake along the way. Don't hesitate to ask if there was something you did not understand though. If you're a bit lost, I suggest reading this recent post on the matter: http://www.sfml-dev.org/forum/viewtopic.php?p=48091&highlight=#48091