Hey guys. Gosu is pretty awesome so far. It is really clean. |Anyway, I followed the step-by-step tutorial on setting up Gosu on Windows and successfully compiled the TextInput.cpp tutorial. No problems. Then I compiled Tutorial.cpp ( with the rocket and collecting stars ) and it compiles fine. However, it does not run fine. It says that there is a bug in the DLL or the stack over-flowed.
This is strange because TextInput gave me absolutely no problems whatsoever. Can someone help out? Thanks!
Sorry to have to tell you that bad news. I hate bugs too. ( I don't think anyone really likes them anyways ). If I ran the EXE via double-clicking it, a Microsoft error report would be shown with the following: "A problem occurred with Tutorial.exe. If you were in the middle of something , we're sorry for the inconvenience" - blah blah blah.
I fixed this problem ( kind of ) my going to the EXE's Properties and clicking on "Compatibility"->"Run this program in compatibility for"->"Windows 95" Then it worked. However, even after exiting, the program would still be running in the background and you would have to manually kill it. When I run it via the MSVC++ 2009 Express IDE, an error message would come up. Then it may run the program and the program runs fine after the message.
Here's the message:
"Windows has triggered a breakpoint in Tutorial.exe. This may be due to a corruption of the heap, which indicates a bug in Tutorial.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12 while Tutorial.exe has focus. The output window may have more diagnostic information."
Oh, Express 2009 is out? :) I think you are the first one to test Gosu with that. I'll try to get a hold of it later and see if I can fix Gosu to work with VS Express 2005-2009.
Does this happen in both Debug and Release configurations, and did you set both to the Multithreaded (not DLL) variants? Does the Call Stack window show any specific function names when the debugger halts the game? If not, you could add breakpoints to see if it dies before main(), in main() before the window is constructed, or during/after Window construction.
I'd ask you to share the project files but I don't have 08 installed right now. I should see if one can install several editions of MSVC, would be helpful in debugging Gosu from time to time :)
It doesn't happen at all in Debug. It works perfectly fine even if I'm executing it through the IDE or not. Only Release mode does it apparently. The Call Stack shows absolutely nothing. And it's not during the game. The game doesn't even load and the error pops up. And the variants are correct. :]
I feel like it has something to do with the containers. When I was starting out with C++ and learning STL vectors and what-not andI didn't do it properly, it would give me an identical message. I could be wrong.
I'm positive it has something to do with the way the animation is set up. I broke apart the examples and did lots of things and it ran fine. However, when I added the animation in, it gave the exact message that I had from the Tutorial.
I'm not sure how to fix it though. Why would it only say something during the Release and absolutely nothing during the Debug if it has something to do with the containers? Maybe there's something is missing in the regular Gosu.lib and the not debug?
Whatever it is, I know it has to do with the containers ( boost and stl for the animation )
OK, have you put breakpoints in the Window constructor and stepped through them? If control doesn't even get there, I think it's something way more low-level than STL containers and boost (which I found to be very reliable) :)
It points to the bracket. This is what the call stack shows: "> GOSU_TEST_ONE_FINDTHEBUG.exe!main(int argc=137820628, char * * argv=0x00000000) Line 185 C++ "
argc results in this: " argc 137820628 int "
and argv results in this "- argv 0x00000000 char * * CXX0030: Error: expression cannot be evaluated "
OK, does that mean it didn't call either of the Window's callbacks, that is draw() and update() did you put breakpoints in there? show() will internally call both of them after doing some setup—still trying to narrow down the places in which this can happen.
I think I may have narrowed it down. The call stack ( at the bottom ) mentioned a line at 163 where I create my character class. Inside of the character class, there is an animation. I commented anything to do with animation and it ran ( though... with no animation ). So I created a test object to see if it was the actual animations or the library itself.
Doing this is just fine: std::vector< boost::shared_ptr< Gosu::Image > > test;
But doing this gives the whole error problem: std::vector< boost::shared_ptr< Gosu::Image > > test; Gosu::imagesFromTiledBitmap ( graphics, Gosu::sharedResourcePrefix() + L"media/RonWalkAnim.png", 110, 236, false, test );
So I think it has something to do with "test" or the function in Gosu.
I have more information that may help us: "GOSU_TEST_ONE.exe': Loaded 'C:\Documents and Settings\BPeppers\Desktop\gosu-windows-cpp-0.7.13\examples\GOSU_TEST_ONE\Release\GOSU_TEST_ONE.exe', Symbols loaded. 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\dinput8.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\secur32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\user32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\glu32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\winmm.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\Documents and Settings\BPeppers\Desktop\gosu-windows-cpp-0.7.13\examples\GOSU_TEST_ONE\Release\fmod.dll', Binary was not built with debug information. 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\msacm32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\ole32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\wsock32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\shell32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\imm32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\Program Files\RK Launcher\RKLauncher.dll', Binary was not built with debug information. 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\msctf.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\version.dll' 'GOSU_TEST_ONE.exe': Unloaded 'C:\WINDOWS\system32\version.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\nvoglnt.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll' 'GOSU_TEST_ONE.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\hid.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\wintrust.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\crypt32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\msasn1.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\imagehlp.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\ntmarta.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\samlib.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\wldap32.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\wdmaud.drv' 'GOSU_TEST_ONE.exe': Unloaded 'C:\WINDOWS\system32\wdmaud.drv' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\wdmaud.drv' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\msacm32.drv' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\midimap.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\dsound.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\version.dll' 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\ksuser.dll' HEAP[GOSU_TEST_ONE.exe]: Invalid Address specified to RtlFreeHeap( 00E20000, 02690498 ) Windows has triggered a breakpoint in GOSU_TEST_ONE.exe.
This may be due to a corruption of the heap, which indicates a bug in GOSU_TEST_ONE.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while GOSU_TEST_ONE.exe has focus.
The output window may have more diagnostic information. First-chance exception at 0x7c96f749 in GOSU_TEST_ONE.exe: 0xC0000005: Access violation reading location 0x7c527428. 'GOSU_TEST_ONE.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll' The thread 'Win32 Thread' (0xee0) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xf04) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xcf8) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x368) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xda4) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x8e0) has exited with code 0 (0x0). The program '[3768] GOSU_TEST_ONE.exe: Native' has exited with code 0 (0x0). "
Not a clue what it means for me, but hopefully that helps you. :/
I can't look into it in detail right now, but it somehow looks as if there was a problem with linking the C++ standard library (RtlFreeMemory). So when anything gets freed internally, the game probably crashes.
This does _not_ have anything to do with boost or the STL :) So maybe I did break MSVC08 compatibility somehow...? Anyone using MSVC08 successfully with the precompiled Gosu?
So the problem is apparently that libraries built with MSVC05 (what I release) are not 100% binary compatible with those built in MSVC08 (which I built & uploaded for you). This is of course horrible, because it means I either have to drop support for MSVC05 or include both sets of libraries in the .ZIP archive. Prepare for a huge download when MSVC10 is out... ;)
On the upside, I can have both versions of MSVC installed side by side, and I hope I can automate building Gosu with both via the msbuild shell tool. I'll see.