SFML community forums
Help => Graphics => Topic started by: Shriek on July 08, 2011, 01:14:12 pm
-
Hi guys I've gone through the tutorial "Graphics - Using render windows" and I tried to make one but it won't work, I get 9 errors all saying parts of code are referenced in function_main, here is the code:
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
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;
}
It's just a copy paste from the tutorial except the #includes and I have linked the sfml-system.lib.
-
Did you also read this tutorial: http://www.sfml-dev.org/tutorials/1.6/start-vc.php
Because of you did then you would know that you have to also link against sfml-window.lib and sfml-graphics.lib
Also that you have to link against the debug libraries(-d.lib) if you are compiling a debug exe.
-
Thanks, but now there's another problem :/. I have included the additional .lib files and it worked but it crashes, so I included the -d.lib files aswell and that didn't help. I get this message when it crashes:
A buffer overrun has occurred in Project3.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.
Never mind I changed my links to -d.lib only and it works now, dunno why though.
-
Thanks, but now there's another problem :/. I have included the additional .lib files and it worked but it crashes, so I included the -d.lib files aswell and that didn't help. I get this message when it crashes:
A buffer overrun has occurred in Project3.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.
Never mind I changed my links to -d.lib only and it works now, dunno why though.
Use the -d-libs in your debug-target, and regular libs in you release target! :)