setting up sfml

This is my second failed attempt at making an SFML application, this time in VS2010.

I've included the headers and linked to the libraries which I think worked but when I try to run my project I get the message:

"The application was unable to start correctly (0xc0150002). Click OK to close the application."

After some googling I found it might be because I'm using VS2010 and there are no precompiled headers for it, but I've opened the solution and build the headers myself and it's still not working.

Thanks.
See my post in this thread
http://cplusplus.com/forum/general/35328/
I tried this, linking to the static libraries, and I now my project doesn't run at all I get a different message

"Unable to start program 'C:\Users......blah blah

This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application max fix this problem. For more details, please see the application event log."
You dont have to use the static libs but you do have to rebuild which ever config your using.
build release static, release dll, debug static, degug dll.
Maybe you built dll and your trying to use static libs but they aren't built with 2010.
I've now got it to compile now and can do the first tutorial on the sfml site, using a sf::Clock, but as soon as try to create a sf::Window or sf::RenderWindow I get an unhandled exception.

"Unhandled exception at 0x7641f7cc in SFMLProject.exe: 0xC0000005: Access violation reading location 0x6e695720."

The call stack is full of files I can't access, other than the line in main which declares a window the only lines I can click in the call stack are both in crtexe.c.

I chose to use SFML because I heard it was easy to use, but this is a nightmare to set up! SDL was a breeze.

EDIT - here's my code, there's nothing that could possibly be wrong though it's just a single line taken straight from the sfml tutorials

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <string>

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

int main()
{
	sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

	return 0;
}
Last edited on
You're not the only one to have this trouble, but I honestly don't know what makes it so difficult. I was able to get it set up without any problems at all.

Things worth noting:

1) Recompile the libs yourself. The binaries available on SFML's site are not compatible with VS2010.

2) Don't mix debug builds of the libs with Release builds of your program and vice versa.


If you do those 2 things, there shouldn't be any problem.
I've already built the libs, 4 of them failed though...and I'm only using the debug libs and running the debug version of my project, so I guess the problem is that some of the libs failed to build, do they need to be built in VS2010 if I'm going to be using 2010 in my project? Or could I build them in 2008? Maybe something goes wrong during the conversion of the sfml project.
Last edited on
I've already built the libs, 4 of them failed though


The only ones that should fail are the ones that use other libs (assuming you don't have those libs installed), like the QT and wx binding libs.

If any of the core libs (system, graphics, audio, window, etc) failed, then that's a problem.

do they need to be built in VS2010 if I'm going to be using 2010 in my project?


Yes.

Maybe something goes wrong during the conversion of the sfml project.


Doubtful. Even if it did it shouldn't cause the problems you're having.


The "compiling but crashing when I try to run" problem sounds to me like you might be linking with a .lib that's incompatible with the .dll that's running.

Do this:

1) Go through your SFML folders, and delete all the .lib and .dll files that you can find.
2) If you copied SFML dlls/libs to any other folders, delete those as well.
3) Basically, remove all SFML binaries from your system
4) Rebuild SFML in VS2010
5) Rebuild your test project

After that you should be fine.
when I delete all the .lib and .dll files then rebuild it only produces six files in the lib folder, they're all object file libraries, with the suffix "-s-d" like "sfml-system-s-d" when I need "sfml-system-d". I think this is because some libraries need some of the others in order to build, but I'de deleted them? Anyway, I get

"cannot open file "sfml-system-d.lib" of course, since it doesn't exist.

Sorry to be a pain but when it comes setting up libraries I've always had trouble, I'm better at c++ than most of my friends yet I always have to ask them to remind me how to link to libs -_-

EDIT - also when I try to build the SFML libraries I get this warning

"C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\Users\g7006454\Desktop\SFML-1.6\build\vc2008\..\..\Temp\win32\Debug\win32.exe) does not match the Linker's OutputFile property value (C:\Users\g7006454\Desktop\SFML-1.6\samples\bin\win32-d.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile)."
Last edited on
after you build are you using the libs in the vc2008 folder? IIRC those are the libs you need to link to
yes
when I delete all the .lib and .dll files then rebuild it only produces six files in the lib folder, they're all object file libraries, with the suffix "-s-d" like "sfml-system-s-d" when I need "sfml-system-d"


The -s suffix means static
the -d suffix means debug.

So sfml-system-s-d means the static debug build of the lib.
sfml-system-d would be the dynamic debug build

If you need the dynamic lib, then build the dynamic lib (change the build configuration, SFML has several.. find the relevent one... it's probably named "Dynamic Debug DLL" or something)

On the bright side, this tells me that deleting the lib binaries was definitely a step in the right direction. The fact that it's not finding a necessary one now means you must have been using an incompatible one previously, hence the reason for the crashes.

EDIT - also when I try to build the SFML libraries I get this warning


That is definitely a weird warning and I don't know what could be causing it, but I doubt it will matter.

It might just be a hiccup in the conversion from the VS2008 project.
Topic archived. No new replies allowed.