SFML community forums
Help => Window => Topic started by: bnz on January 21, 2010, 08:15:06 pm
-
Hello,
I'm new to SFML and also quite new to C++ in general, so I tried the official tutorials as a start.
However I'm now stuck at the tutorial on creating windows (http://www.sfml-dev.org/tutorials/1.5/window-window.php). I compiles fine (using MSVC++ 2010 beta2 and the code included in the tutorial), but when I start the application I get the following message:
"Unhandled exception at 0x75f19f11 in SFML Window.exe: 0xC0000005: Access violation reading location 0x6e695720."
When I start the exe directly from the Windows Explorer it simply says that the exe doesn't work anylonger.
I'm using Windows 7, by the way.
Do I need Qt or wxWidgets to succesfully run this program? Do you have any idea what I'm doing wrong?
Thanks,
bnz
-
Have you linked the correct Libs? (-d for Debug)...
-
Yes, at least I think so.
Here are two screenshots of the properties:
(http://www4.pic-upload.de/thumb/21.01.10/u6zmzcckdrlh.jpg) (http://www.pic-upload.de/view-4328457/kljhk.jpg.html) (http://www4.pic-upload.de/thumb/21.01.10/bvxbh3mmpoa.jpg) (http://www.pic-upload.de/view-4328458/Unbenannt.jpg.html)
In the folder, where the executable is located, I added the sfml-window-d.dll and the sfml-system-d.dll.
bnz
-
You're linking only to window and main, not system. Add sfml-system-d.lib to the list.
-
Unfortunately that didn't change anything.
The exeption is thrown at the following line:
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
By the way: Why did I have to link to smfl-system-d? Wouldn't the compiler complain if something was missing?
bnz
EDIT: Just for the fun of it, I tried to link to the non-debug versions of the librarys and after copying the needed dlls into the executable's folder it worked.
I hope this gives you some clues, why it is not working with the debug versions.
bnz
-
You should recompile SFML with your Visual Studio 2010. VS versions are highly incompatible, and the SFML SDK only provides precompiled binaries for VS 2005 and 2008.
-
Oh, okay.
I will try that this evening.
Thanks,
bnz
-
Well, I just tried to build SFML with Visual Studio 2010 beta2 and I'm quite lost. =)
Following the tutorial does not really work or at least I'm not doing it right.
When I open the SFML.sln, the "Visual Studio Conversion Wizard" starts and wants to convert the project. When I then select the whole solution, containing 18 projects, and select "Build" it does something, but I actually have no clue what it does or how I could manipulate it.
It also seems strange that the projects contains sub-projects like "pong" or "wxwdgets".
Well, as you see I am a little confused and it would be great, if you could give me a pointer on how to compile SFML correctly, so that I have all needed files (all .dll and .lib files with all the different endings) at the end.
Thanks,
bnz
-
When I then select the whole solution, containing 18 projects, and select "Build" it does something, but I actually have no clue what it does or how I could manipulate it
Do you have the "output" tab opened? What messages does it show?
It also seems strange that the projects contains sub-projects like "pong" or "wxwdgets".
It's not sub-projects, I just put them in virtual folders to separate between SFML libraries and example applications.
Well, as you see I am a little confused and it would be great, if you could give me a pointer on how to compile SFML correctly, so that I have all needed files (all .dll and .lib files with all the different endings) at the end.
It should really not be harder than clicking on "build" (after selecting the configuration that you want to build) ;)
-
I think now I got it! Well, almost.
The problem was, that I did not exactly know where to look for the files, now I realized that they are directly created in the correct folder. =)
So in the end it was really not harder than "clicking on "build"", as you said. ;)
Now to the reason I said "almost":
When compiling the Release DLLs it says:
Rebuild All: 1 succeeded, 5 failed, 12 skipped
But all files are there. Could that be a problem?
bnz
EDIT:
Still one problem: How can I create the "sfml-xxx-d.lib" files? I only can choose between Debug DLL (sfml-xxx-d.dll) and Debug static (sfml-xxx-s-d.lib).
-
When compiling the Release DLLs it says:
Rebuild All: 1 succeeded, 5 failed, 12 skipped
But all files are there. Could that be a problem?
The 5 projects that fail are probably samples. You can easily see that in the output tab.
How can I create the "sfml-xxx-d.lib" files? I only can choose between Debug DLL (sfml-xxx-d.dll) and Debug static (sfml-xxx-s-d.lib).
Hmm, you should also have "Release static" and "Release DLL". Maybe something went wrong with the conversion wizard?
-
Hmm, you should also have "Release static" and "Release DLL". Maybe something went wrong with the conversion wizard?
Sorry, I was a bit imprecise here.
I meant that "Debug DLL" and "Debug static" are the only two "debug modes" that I can choose between. I assume that for the "sfml-xxx-d.lib" I need a simple "Debug", like the one I can choose for the "sfml-main" project.
There are also "Release static" and "Release DLL" but none of them results in "sfml-xxx-d.lib" files.
bnz
-
No no, sfml-xxx-d.lib is the dynamic debug version.
Suffixes are defined so that "-d" is debug and "-s" is static (release and dynamic have no suffix).
-
Okay, but how can I create the "sfml-xxx-d.lib" files?
Here are some screenshots, that show all different configurations I tried:
(http://www4.pic-upload.de/thumb/23.01.10/t6lzr7ydmul.jpg) (http://www.pic-upload.de/view-4343428/cfg1.jpg.html) (http://www4.pic-upload.de/thumb/23.01.10/31xvymr8teos.jpg) (http://www.pic-upload.de/view-4343429/cfg2.jpg.html) (http://www4.pic-upload.de/thumb/23.01.10/r6wqhfupjbsd.jpg) (http://www.pic-upload.de/view-4343430/cfg3.jpg.html) (http://www4.pic-upload.de/thumb/23.01.10/3v6ug917xom.jpg) (http://www.pic-upload.de/view-4343431/cfg4.jpg.html)
And these are the resulting files:
(http://www4.pic-upload.de/thumb/23.01.10/vcd4qzmuuk5w.jpg) (http://www.pic-upload.de/view-4343432/files.jpg.html)
(By the way: Can I delete the .ilk files? )
As you see, the "sfml-xxx-d.lib" files are missing.
Since this is the first library I have to compile by myself, please forgive my, if my questions are trivial. =)
bnz
-
You don't change the current active configuration in this window (this is the solution's properties, I almost never go there), you just setup which configuration for each project correspond to the "global" configuration (the one in the top-left corner). Like I said, you don't have to do such complicated things to build SFML ;)
To actually select the configuration to build, you should have a combobox in the toolbar.
-
To actually select the configuration to build, you should have a combobox in the toolbar.
So when I simply change select another build mode in the dropdown menu, framed red in the following picture, it should build the correct files?(http://www4.pic-upload.de/thumb/23.01.10/6v63e2xh44ft.jpg) (http://www.pic-upload.de/view-4344770/Unbenannt.jpg.html)
Because I tried that. I built in "Debug", "Debug DLL", "Debug static", "Release", "Release DLL" and "Release static" mode and I still didn't get the "sfml-xxx-d.lib" files. The only -d.lib file I get, is "sfml-main-d.lib".
So just to make sure I'm doing everything correctly, I'm going to list the single steps:
- Open SFML.sln located in \SFML-1.5-sdk-windows-vc2008\SFML-1.5\build\vc2008.
- Converting the project with the Visual Studio Conversion Wizard
- Deleting all files in \SFML-1.5-sdk-windows-vc2008\SFML-1.5\lib\vc2008, because that's the directory where the new files will be located
- Choosing "Debug" from the combobox (red frame in picture above) and then Build->Build solution. This results in "sfml-xxx-s-d.lib" files being created in \SFML-1.5-sdk-windows-vc2008\SFML-1.5\lib\vc2008
- Repeating last step with other build modes
Is it correct that "sfml-xxx-s-d.lib" files are created, when I only select "Debug" as build mode? Because when I afterward select "Debug static" as build mode, it says that the 6 files were already up-to-date.
bnz
-
You should never select "Debug" or "Release" (they exist only for samples). I think that it maps to the static configurations for the SFML libraries (which answers your last question).
- Debug static produces sfml-xxx-s-d.lib files
- Debug dynamic produces sfml-xxx-d.lib (and .dll) files
- Release static produces sfml-xxx-s.lib files
- Release dynamic produces sfml-xxx.lib (and .dll) files
-
I think I'm getting closer. :D
Debug dynamic produces sfml-xxx-d.lib (and .dll) files
With "Debug dynamic" you mean "Debug DLL", right?
Because, if so, it produces sfml-xxx-d.dll files and sfml-xxx-d.ilk files, not sfml-xxx-d.lib files.
Is there maybe a setting, which changes the file ending from .ilk to .lib (or can I simply do so by myself :) )?
bnz
-
With "Debug dynamic" you mean "Debug DLL", right?
Yep, sorry.
Because, if so, it produces sfml-xxx-d.dll files and sfml-xxx-d.ilk files, not sfml-xxx-d.lib files.
You can ignore .ilk files, they are for debugging.
Maybe something was changed or lost during the conversion. Have you searched the .lib files in other directories?
You can also check one option in any SFML project: "Linker" -> "Advanced" -> "Import library" -> this should be the path and name of the produced .lib file.
-
Then I guess something went wrong during conversion, because "Linker" -> "Advanced" -> "Import library" is empty.
The follwing picture shows the situation:
(http://www3.pic-upload.de/thumb/23.01.10/4jwnde14yd.jpg) (http://www.pic-upload.de/view-4347425/pic.jpg.html)
I don't know if this is of any help, but here is the Build-Log of the build with "Debug DLL" setting: BuildLog.txt (http://www.file-upload.net/download-2189402/BuildLog.txt.html)
bnz
-
Then I guess something went wrong during conversion, because "Linker" -> "Advanced" -> "Import library" is empty.
Weird. Anyway, try to put "$(TargetDir)$(TargetName).lib" there.
-
(http://www3.pic-upload.de/thumb/23.01.10/mx21zzbui.jpg) (http://www.pic-upload.de/view-4347629/pic.jpg.html)
I changed the properties of every sfml project to the above, but it still doesn't produce the sfml-xxx-d.lib files.
bnz
-
What does the build log say?
-
I uploaded the new build log here (http://www.file-upload.net/download-2190504/BuildLogNew.txt.html).
For my taste there are too many fatal errors and warnings, but I don't know in how far this is "normal".
bnz
-
There are two interesting things:
Creating library C:\Users\bnz\Downloads\SFML-1.5-sdk-windows-vc2008\SFML-1.5\Temp\vc2008\sfml-network\Debug DLL\sfml-network.lib
--> this is where the .lib files are created
warning MSB8012: TargetName(sfml-network) does not match the Linker's OutputFile property value (sfml-network-d). 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).
--> that seems to be the problem
I don't know what happens here, but it seems to be related to some new stuff in VS 2010.
-
So what would you suggest to do?
Is there another way to compile the library?
bnz
-
I'm not familiar at all with VS 2010 and MSBuild, so I'm affraid I can't help you further, sorry.
But you should find the lib files in "C:\Users\bnz\Downloads\SFML-1.5-sdk-windows-vc2008\SFML-1.5\Temp\vc2008\sfml-network\Debug DLL", don't you?
-
But you should find the lib files in "C:\Users\bnz\Downloads\SFML-1.5-sdk-windows-vc2008\SFML-1.5\Temp\vc2008\sfml-network\Debug DLL", don't you?
Yes, I do.
For now, I simply renamed them to "sfml-xxx-d.lib", and it seems to work fine, finally. =)
Thanks for all your patience, help and of course for this great library! I just continued with the tutorial and I am stunned how easy things are!
I guess, when Visual Studio 2010 goes out of beta, you will provide precompiled files, as for VS 2008?
bnz
-
For now, I simply renamed them to "sfml-xxx-d.lib", and it seems to work fine, finally. =)
Renamed to what? They seem to have the right name, from the build log.
I guess, when Visual Studio 2010 goes out of beta, you will provide precompiled files, as for VS 2008?
Probably :)
-
Renamed to what? They seem to have the right name, from the build log.
The only .lib files I could find in the directory you mentioned were called "sfml-xxx.lib". The suffix "-d" was missing, so I went ahead and added it. =)
bnz
-
Ah, you're right :)