News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Compiling the SDL version in Windows

Started by jamespetts, May 09, 2009, 02:14:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

How does one compile the SDL version of Simutrans under Windows?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

vilvoh

Perhaps with cygwin? It's a Linux-like environment for Windows that makes possible to port software running on POSIX systems (such as Linux, BSD, and Unix systems) to Windows.

Escala Real...a blog about Simutrans in Spanish...

jamespetts

How would I go about setting that up?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

VS

You could probably dive into depths of mingw and makefiles and all that nastiness. IIRC prissi uses cygwin+mingw... but better wait for someone [other than me] who knows what he talks about.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

prissi

Mingw or MSVC++. Have a look at the official SDL-pages, they have a version for MSVC too ... You need then include SDL_sound and simsys_s.cc. (I haven't tried this with MSVC but i should work ... )

jamespetts

Ahh, I have tried with MSVC++, and it doesn't work - I get the following errors:


1>simsys_s.cc
1>.\simsys_s.cc(678) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char *' to 'LPCWSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>.\simsys_s.cc(682) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char *' to 'LPCWSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast


Any idea how to resolve them?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

Cast them or switch off error 2664. Or better use MessageBoxA, since the strings will be ASCII anyway ...

jamespetts

Prissi,

thank you very much. I switched to MessageBoxA, but then got this error:


1>simsys_s.obj : error LNK2019: unresolved external symbol _dr_screenshot_png referenced in function "int __cdecl dr_screenshot(char const *)" (?dr_screenshot@@YAHPBD@Z)
1>Debug (SDL)\Simutrans-Experimental-SDL.exe : fatal error LNK1120: 1 unresolved externals


Any ideas?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

add also dr_scr4eenshot_w32.c to your makefile?

jamespetts

Prissi,

sorry if this is a silly question - but where would I find dr_scr4eenshot_w32.c?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

VS

James, the file is called simsys_w32_png.c and I was able to locate it after some rather rudimentary searches. Although, the difference might be that I knew from previous rummaging through code that the libraries' bindings are mostly in simsys_*files.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

jamespetts

VS,

that can't be right: that file is already included in the project, and it is a GDI file. The very top has the following code:


#ifndef WIN32
#error "Only Windows has GDI+!"
#endif

// windows Bibliotheken DirectDraw 5.x
#include <windows.h>
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

VS

Still, it is the file containing implementation of dr_screenshot_png. I don't see anything else in it, so it might be safe to assume it's what you need and - just go ahead and try...? Although there might be some problem with leading underscore? It (the first _) isn't anywhere in my version of sources.

FWIW, saving as png can be done by linking to either libpng, or any other library (capable of that feat), which is in this case gdi+. So it's just for saving the picture, not as the whole backend. Or at least it seems so to me.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

jamespetts

VS,

ahh, you were right: enabling that did let it compile. It was somewhat confusing - I thought that it was a GDI implementation. However, now, I have another problem: as soon as it starts, it immediately exits again, with a code of -1:


'Simutrans-Experimental-SDL.exe': Loaded 'F:\My Documents\Development\Simutrans\simutrans-experimental-sources\Debug (SDL)\Simutrans-Experimental-SDL.exe', Symbols loaded.
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\Program Files\mlt\bin\SDL.dll', Binary was not built with debug information.
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\winmm.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\secur32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\user32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcp90d.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcr90d.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\Program Files\Kaspersky Lab\Kaspersky Anti-Virus 2009\mzvkbd.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\psapi.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\Program Files\Kaspersky Lab\Kaspersky Anti-Virus 2009\mzvkbd3.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\dinput.dll'
'Simutrans-Experimental-SDL.exe': Unloaded 'C:\WINDOWS\system32\dinput.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll'
'Simutrans-Experimental-SDL.exe': Unloaded 'C:\WINDOWS\system32\ddraw.dll'
'Simutrans-Experimental-SDL.exe': Unloaded 'C:\WINDOWS\system32\dciman32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\dinput.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\msctf.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\Program Files\Logitech\SetPoint\GameHook.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\Program Files\Logitech\SetPoint\lgscroll.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca\msvcr80.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\ntmarta.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\ole32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\samlib.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\wldap32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\version.dll'
'Simutrans-Experimental-SDL.exe': Unloaded 'C:\WINDOWS\system32\version.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\hid.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\wintrust.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\crypt32.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\msasn1.dll'
'Simutrans-Experimental-SDL.exe': Loaded 'C:\WINDOWS\system32\imagehlp.dll'
'Simutrans-Experimental-SDL.exe': Unloaded 'C:\WINDOWS\system32\ddraw.dll'
'Simutrans-Experimental-SDL.exe': Unloaded 'C:\WINDOWS\system32\dciman32.dll'
'Simutrans-Experimental-SDL.exe': Unloaded 'C:\WINDOWS\system32\dinput.dll'
'Simutrans-Experimental-SDL.exe': Unloaded 'C:\WINDOWS\system32\setupapi.dll'
'Simutrans-Experimental-SDL.exe': Unloaded 'C:\WINDOWS\system32\hid.dll'
The program '[5448] Simutrans-Experimental-SDL.exe: Native' has exited with code -1 (0xffffffff).


Any ideas what this problem might be?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

VS


My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

prissi


jamespetts

Which version should I have? I downloaded the latest...
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.