SFML community forums
General => General discussions => Topic started by: AngelHoof on December 01, 2010, 05:43:41 am
-
Hi!
Firstly, sorry if I'm just being stupid - I've always wanted and tried to be a computer geek but sometimes I just think it may not be for me...
Anyway, my problem is this: When I build/compile (whichever is the proper word) the following code
#pragma comment (lib, "sfml-window.lib")
#include <SFML/Window.hpp>
#include <iostream>
#define width 800
#define length 600
#define depth 32
int main()
{
sf::Window MainWindow(sf::VideoMode(width, length, depth), "Tester");
bool running = false;
while (running);
{
MainWindow.Display();
}
return 0;
}
works fine - I had big problems with getting the libs and linkers and whatnot to work correctly, so I was pretty bummed to see that when I actually run this I get an error saying
"Run-Time check failure #2 - Stack around the variable "MainWindow" was corrupted."
If I hit the Continue button after this, I get another message telling me that the .exe has been "buffer overrun, corrupting the internal state of the program".
I could do the tutorials fine on Bloodshed Dev-Cpp, which leads me to believe that I've done something wrong, or have forgotten something.
Not being able to finish even the first tutorial makes me a sad panda, truly.
Thanks for any replies!
Sincerely,
AngelHoof
-
You must link to debug libraries (-s) in debug mode. This is explained in bold characters in the "getting started" tutorial... :cry:
And if you're using Visual C++ 2010, you'll have to recompile SFML as there's no precompiled libraries for this compiler (VC++ 2008 libraries are not compatible).
-
Oh crap, I'm embarassed now.
Sorry Laurent! I'm really bad with this kind of stuff, I realize that it was an unbelievably stupid miss :oops:
I changed the #pragma to sfml-window-d (as the tutorial stated), and put the -d .dll's in my system32 folder... It compiles fines, fires the console but gives me this now;
"Unhandled exception at 0x76bbcdeb in GameRPG.exe: 0xC0000005: Access violation reading location 0xcc007265."
But... You say that I should use -s?
sfml-window-s.lib doesn't even let me compile :/
-
And if you're using Visual C++ 2010, you'll have to recompile SFML as there's no precompiled libraries for this compiler (VC++ 2008 libraries are not compatible).
-
Ah, yes, which I was intending to ask about how to do...
Sorry if I'm comming out as a complete retard - I'm doing my best :?
I followed the instructions on the bottom of the VC Getting Started tutorial, when I run the SFML.sln it just asks which program to open it with, I pick VC C++ Express 2010 (obviously) and then it starts "converting" the files, which it fails at with pretty much everything except for the sfml-main/window/graphics/audio/network etc.
I'm assuming this is not how it was meant to be played out, so what am I doing wrong?
Sincerely,
AngelHoof
-
it fails at with pretty much everything except for the sfml-main/window/graphics/audio/network etc.
So it fails for everything except everything? :D
If you have sfml-main/window/graphics/audio/network then you have SFML. You don't need to care about the samples.
I'm assuming this is not how it was meant to be played out, so what am I doing wrong?
If you have problems with the conversion, you can find a lot of other topics that may help you on this forum. A member has even made a video tutorial somewhere.
-
Well, it says that it successfully converted the main/window and whatnot, so how come It's still not working?
-
It's still not working?
What did you do after converting? Did you compile the release-dynamic configuration? What errors do you get, still the same?
-
It's still not working?
What errors do you get, still the same?
Yes, the same.
Did you compile the release-dynamic configuration?
I wish I could answer that - Umm, I'm gonna have to go with "No" though :o
-
I wish I could answer that - Umm, I'm gonna have to go with "No" though
You can select the configuration in the dropdown combobox in the toolbar.
-
Through the configuration manager?
If so, i have 4 options, release-static, release-dll, debug-static and debug-dll.
-
Yep, release-dll is what you use in your project.
-
Okay... I set them all to release-dll in the "SFML" project, saved all the project files... Umm, still aint working :(
-
Sorry to ask such a stupid question, but did you actually compile SFML after selecting the configuration? And properly use the new libraries in your project?