SFML community forums
Help => General => Topic started by: Zauren on August 06, 2009, 02:59:43 am
-
I'm an aspiring coder, and integrating SFML has been a new experience for me. I've managed to wrestle out all the speedbumps through searching and experimenting, but this one is a bit odd. I'm sure it's something simple but have little clue what the culprit is.
I took this code and slapped it in...
#include <SFML/Graphics.hpp>
int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
// Start 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 the screen (fill it with black color)
App.Clear();
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}
And when I run it, it opens the new window as expected, but then immediately goes white and crashes. But the debug window says it worked normally.
My eyes are presently ?_? I'm using Visual Studio 2008, if that matters.
-
Make sure that you're not mixing debug and release configurations.
-
All I have is sfml-window.lib sfml-graphics.lib in my additional dependences, unless that means something beyond just using the linker...
-
All I have is sfml-window.lib sfml-graphics.lib in my additional dependences, unless that means something beyond just using the linker...
Here's your problem: You aren't linking to sfml-system.lib.
-
All I have is sfml-window.lib sfml-graphics.lib in my additional dependences, unless that means something beyond just using the linker...
And you compile in debug configuration or release?
-
If it's debug, you have to put a -d at the end of the lib names.
Also, don't you have to define SFML_DYNAMIC in the preprocessor definitions?
-
system wasn't in since it wasn't needed, but I stuck it in anyway to be sure. Same error. Dynamic is also set, that was the first thing I tried.
Oh god, I see what the issue was. I WAS compiling in debug without the -d libraries using 'start without debugging', because for all my time with Visual Studio that's how I tested the program instead of building it.
...I toldja it was something stupid! Many thanks!
-
system wasn't in since it wasn't needed, but I stuck it in anyway to be sure. Same error. Dynamic is also set, that was the first thing I tried.
Oh god, I see what the issue was. I WAS compiling in debug without the -d libraries using 'start without debugging', because for all my time with Visual Studio that's how I tested the program instead of building it.
...I toldja it was something stupid! Many thanks!
I'm sorry, but reading the tutorials for setting up, it says that the Window Library depends on the System Library, meaning you cannot use the Window Library without the System Library. So how is it that you are able to run it without System?