[Wine] wine can not handle running a simple SDL program that calls

WK1 wineforum-user at winehq.org
Tue Jun 3 13:15:15 CDT 2008

I have a simple SDL program, which I've used mingw to compile. It attempts to call cout more than once. It crashes when calling it the second time. Windows handles this program just fine. However, running this program using wine gives the following error:
$ wine tmp.exe 
wine: Unhandled page fault on write access to 0x00000000 at address 0xb7cc3825 (thread 0009), starting debugger...

I moved my ~/.wine directory, and tried again. Same result.

I've checked the internet for a solution. Most of the posts are unanswered. However, there are a few bug reports in the wine BTS, but I don't think the solution in there affects me. It was talking about "new" glibc versions, but they all date from 2006. They also seemed to only apply to people compiling from source.

I am using Debian Testing. I am using the wine version from the Debian repos. It is version 1.0-rc1-1. These are the wine packages I have installed: libwine libwine-alsa libwine-cms libwine-gl libwine-gphoto2 libwine-ldap libwine-print libwine-sane wine wine-bin wine-utils. My libc version is 2.7.10, and my kernel is 2.6.22-3-686. I am using mingw 4.2.1.dfsg-1.

Here is the source for the simple program that I am trying to execute:

#include <iostream>
#include <SDL/SDL.h>

using namespace std;

int main(int argc, char ** argv)
	cout << "Hello" << endl;
	cout << "Goodbye" << endl;
	return 0;

I compile with this command:  i586-mingw32msvc-c++ -o tmp.exe tmp.cpp -I$HOME/tmp/include -L. -lmingw32 -lSDLmain -lSDL
I got my SDL.dll and libSDLmain.a files from the official SDL download page. ~/tmp/include contains the SDL include headers.

When I execute tmp.exe, I get the error message specified above. SDL for Windows won't write to stdout. Instead, it writes to stdout.txt in the current directory. After executing, stdout.txt contains "Hello", but it does not contain "Goodbye". Also, if you remove the "Goodbye" line, then wine will execute tmp.exe just fine.

Anyone know how I can get wine to be able to run more than one cout in an SDL program?

I just checked, and this problem is only with cout. It does not occur with printf.

More information about the wine-users mailing list