Compiling an SDL application in Windows

I’ve recently been toying with the idea of trying to compile my SDL port
of Stella in a Windows environment. I’ve been spending a lot of time
trying to get the Windows DirectX port up to speed, and at this point
it seems it would be easier to simply use the SDL port in Windows
instead.

Right now, it has a simple makefile and uses g++. What environment
should I use in Windows? DJGPP, Cygwin, Visual Studio (6 or .NET),
etc? This is all so confusing. Development under Linux is so much
easier.

Thanks for any info,
Steve

Ding! Ding! Ding! We have a winner!..

Seriously, all my Windows apps are developed and compiled in Linux using
mingw32. Any reason why you don’t want to take that route?

Partial example makefile:

CC= gcc
CFLAGS= -ggdb -Wall -Wno-switch -Wno-parentheses -Wno-unused sdl-config --cflags -DLINUX
LIBS=-lc -lm sdl-config --libs

WINCC=/usr/local/cross-tools/bin/i386-mingw32msvc-gcc
WINCFLAGS=-Wall -O2 -fomit-frame-pointer -s -I/usr/local/cross-tools/include
sdl-config --cflags -DWIN32
WINLIBS=/usr/local/cross-tools/lib/SDL.dll

JPOn Saturday 29 November 2003 07:11 am, Stephen Anthony wrote:

This is all so confusing. Development under Linux is so much
easier.

No reason. That’s why I asked the question, to see what the
possibilities were. As a matter of fact, I already had MingW32
installed under Windows, but I forgot all about it (I don’t use Windows
that much).

SteveOn Saturday 29 November 2003 12:36 pm, j_post wrote:

On Saturday 29 November 2003 07:11 am, Stephen Anthony wrote:

This is all so confusing. Development under Linux is so much
easier.

Ding! Ding! Ding! We have a winner!..

Seriously, all my Windows apps are developed and compiled in Linux
using mingw32. Any reason why you don’t want to take that route?

Stephen Anthony wrote:

This is all so confusing. Development under Linux is so much
easier.

MinGW + MSYS offer an environment similar to Linux. Not exactly, but one
can work with it. I personally prefer to write my Makefiles than
clicking on some compiler settings checkboxes in some IDE. Matter of
taste…

No reason. That’s why I asked the question, to see what the
possibilities were. As a matter of fact, I already had MingW32
installed under Windows, but I forgot all about it (I don’t use Windows
that much).

In my eyes MinGW is one of the best choices, especially if you are used
to working on Linux. Additionally, using the same compiler makes life
just easier if you develop on Linux and then compile on Windows,
regardless of the theory that the same code should be compiled by any
ANSI confirm compiler. That’s just the theory. :=)
The drawback of MinGW is, it’s quite slow. Slower than gcc on Linux, and
much slower than Borlands or Microsofts compilers. The created
executables are large if you have C++ code. But I dont see that as a
real disadvantage with todays enourmous harddrives. Who cares if it’s 3
or 5 MB?
Cygwin offers in my eyes little advantage except you really need the
POSIX layer. The compiler is the same, gcc. If you dont need the cygwin
libs, MinGW works just as well.

Other options might be Borlands free commandline tools or their
commercial IDE. Borlands compiler is certainly good and recommanded.
Microsoft Visual C depends if you are willing to invest a good amount of
cash and love to click lots of checkboxes, though you can also use
makefiles, but you need to write them from scratch. Visual C is very
fast and produces small binaries, and the debugger is quite usable.
Version 7 does not suck as much concerning standards like MSVC 6 does.
Digital Mars is another high-quality player among the free compilers,
compiles extremely fast and produces small and fast code, but I never
got it working with SDL (does not mean it does not work, I did not try
hard.)

My personal preferences are MinGW and Borland. But such recommendations
can quickly evolve into a religious war. :slight_smile:

Flawlessly together with SDL work MinGW, MSVC and Borlands compiler.

Cross-compiling Windows executables on Linux is an option many people
use, though I personally prefer to compile Windows binaries on Windows,
as I simply want to test the stuff right away. Depends on your
requirements. You can of course do both.

Peter

[snipped]

In my eyes MinGW is one of the best choices, especially if you are
used to working on Linux. Additionally, using the same compiler makes
life just easier if you develop on Linux and then compile on Windows,
regardless of the theory that the same code should be compiled by any
ANSI confirm compiler. That’s just the theory. :=)
The drawback of MinGW is, it’s quite slow. Slower than gcc on Linux,
and much slower than Borlands or Microsofts compilers. The created
executables are large if you have C++ code. But I dont see that as a
real disadvantage with todays enourmous harddrives. Who cares if it’s
3 or 5 MB?

When you say MinGW is slow, do you mean slow in compiling or slow in
program execution? Because if you see my previous email, it seems that
SDL code compiled with MinGW is 5-10 times slower than gcc in Linux.
If that’s true across the board (and not just a fault of my code), then
that solution is unacceptable.

Thanks for the info,
SteveOn Saturday 29 November 2003 04:20 pm, Peter Strempel wrote:

Stephen Anthony wrote:

When you say MinGW is slow, do you mean slow in compiling or slow in
program execution?

I was referring to the speed of the compilation process, not runtime
speed. There are a couple of benchmarks, MinGW scores pretty well,
though in most worse than MSVC. However, those benchmarks should be seen
with much care and are mostly meaningless for ones specific application.
Best results seems to show Intels ICC compiler, but I dont know under
which conditions this is available for Windows. Last I checked it was
commercial.

If your program is quite easy to evaluate concerning speed, just build
it with the various compilers and see yourself. That should mean much
more than benchmarks on obscure algorithms. :slight_smile:

Peter

Stephen Anthony wrote:

Right now, it has a simple makefile and uses g++. What environment
should I use in Windows? DJGPP, Cygwin, Visual Studio (6 or .NET),
etc?

MinGW and Visual C++ .NET 2003 are both valid choices. The latter compiles
faster and produces somewhat faster code, so it’s my primary choice. Forget
DJGPP (which is for DOS, not Windows), Cygwin (which comes with a heavy UNIX
emulation layer), and earlier releases of Visual C++ (which have crappy C++
support).–
Rainer Deyke - rainerd at eldwood.com - http://eldwood.com