SDL on CodeWarrior for Windows (with solutions to problems)

Hi Darrell,

thank you for your fast reply.

I did not even notice there already were CW projects. I implied it would be
only Mac CW projects if at all. Actually this is the first time ever I found
Windows CW project files somewhere. Congratulations, guys!

Here are the problems I had under CW7.2 (Win) with the project files that
were provided with SDL 1.2.3:

  1. There was a path


which now seems to have been split into



  1. The next problem was that MWCRTL51.lib does not exist anymore in CW7.
    According to the “MSL C Release Notes.txt” I should have replaced it with
    "MSL_Runtime_x86.lib", but it didn’t work due to Undefined Symbol “__file”.
    So I replaced it with “MSL_C_x86.lib” which did the job. I am not sure
    though if this was absolutely correct.

  2. In the Release version I had to add the file “SDL_expose.c” to the
    "events" group. The debug version still built correctly. Since I am new to
    SDL it is up to you to understand why :wink:

  3. In contrast to the readme file, in the release builds the compiler
    optimizations were still turned off!? Maybe this was due to the changed
    optimization settings after CW5. At Level 4 it perfectly compiles now, but
    of course I can not guarantee that it works perfectly.

  4. None of the Testers could link as no Win32 specific libraries (like
    Kernel32.lib, User32.lib) were built into the LIB files. Seems it is
    necessary to delete them (in the SDL projects) and re-include them. Then it
    works. Oh, well…

  5. All test projects complained about an undefined symbol “_main” in
    SDLmain.x86.lib or MSL-All-DLL_x86.lib (maincrt.obj).

I found this define in SDL_main.c:

#if defined(_MSC_VER) && !defined(_WIN32_WCE)
/* The VC++ compiler needs main defined */
#define console_main main

Seems it applies to CW7 Win as well. If I use that define, all test programs
can compile and even run :wink:

I changed the first line to

#if (defined(_MSC_VER) || defined(MWERKS)) && !defined(_WIN32_WCE)

Now it works.

I suggest the responsible person changes this in the original source file as

(Btw: Since I am new here… Who is responsible for this? Or how does all
this work generally?)

  1. Now there is only one problem left: Every program crashes when exiting
    with an access violation. Since it took me over 5 hours now to be able to
    run the test programs, I guess I will leave this problem to either someone
    else or tomorrow…

Best regards,
Mario> ----- Original Message -----

From: (Darrell Walisser)
Sent: Tuesday, February 05, 2002 9:06 PM
Subject: Re: [SDL] SDL on CodeWarrior for Windows

On Tuesday, February 5, 2002, at 01:07 PM, Mario Knezovic wrote:

Under CW7 I get several linker errors like

Link Error : Undefined symbol: __imp__exit in
SDLmain.lib (.\Release\SDL_main.obj)
Link Error : Undefined symbol: __imp__strncpy in
SDLmain.lib (.\Release\SDL_main.obj)

Any ideas?

The last time I revised the CodeWarrior projects (about a month ago
now), I had the Windows libs & tests compiling. This was under
CodeWarrior 5.x. Do the tests compile under CW7/Windows? If so, you can
use the testers as a guide as to what files should be in your project.

If not, the location of some required libs has changed under CW 7, which
is why you see these errors. The errors you’ve mentioned look like the C
library is missing; it should be located in a subdirectory of the “MSL”
(Metrowerks Standard Library) directory (located in the root CodeWarrior