NO

Author Topic: Setting up SDL  (Read 3000 times)

runar

  • Guest
Setting up SDL
« on: June 03, 2011, 07:40:55 PM »
Hello, and excuse me for being a bit of a retard or something ???, because all I can do is find trouble.

    I want to try againg at C development with SDL, so I could make small program/games for people with phisican and mental disabilities. Since the ONG that I work at does have little money to spend in software, i thougt that making the programs as portable as I could, then i could implement them on old computers over Linux. My dev machine does have Windows XP, though.

    I installed PellesC 6.0 and the matching Windows SDK., and downloaded the last version of the SDL sources, the VC6 dev headers, and the win32 binary. Aftar that, unzipped them all as folders. I've tried to follow a tutorial I found to install it, except than following all steps in console, so I could build an easy installer later that I could share.

    1. I have copied the headers from the dev-vc6 zip to a subfolder of the windows headers:
copy ".\SDL-devel-1.2.14\include\*.h" "%ProgramFiles%\PellesC\include\win\SDL"

    2. I have built an import library of the binary library with:
"%ProgramFiles%\PellesC\bin\polib.exe" ".\SDL-1.2.14-win32\SDL.dll" /out:SDL.lib
move /y SDL.lib "%PELLESC%\lib\Win\SDL"

   3. I'm trying to build the static stub of the sdlmain as a lib file, and i'm stumped.
"%ProgramFiles%\PellesC\bin\pocc.exe" /Tx86-coff /Ot /Gd /Ze /I"%ProgramFiles%\PellesC\include\win\SDL" "SDL-1.2.14\src\main\win32\SDL_win32_main.c"

    I get several warnings, but it builds the obj file:
- Use <stdlib.h> instead of non-standard <malloc.h>
- SDL-1.2.14\src\main\win32\SDL_win32_main.c(321): warning #2154: Unreachable code.
- SDL-1.2.14\src\main\win32\SDL_win32_main.c(354): warning #2030: '=' used in a conditional expression.

  4. Once that I've done that, how do I build the lib file? I tried compiling the demo project resizer.lib on verbose so I could see what parameters are required for having other libs as dependences in a lib file, and build a lib instead of an exe, but that one fails too: it doesn't even compile:

    C:\Program files\PellesC\include\win\windows.h(91): fatal error #1035: Can't find include file <excpt.h>.

    The most that i've managed is:

    "%ProgramFiles%\PellesC\bin\polink.exe" "SDL-1.2.14\src\main\win32\SDL_win32_main.obj" /LIBPATH:"%ProgramFiles%\PellesC\lib\win\SDL" /SUBSYSTEM:windows

    Those of course fails because I can't make it link with the SDL.lib, so i get:

POLINK: error: Unresolved external symbol '_SDL_Quit'.
POLINK: error: Unresolved external symbol '_SDL_strlcpy'.
POLINK: error: Unresolved external symbol '_SDL_strlcat'.
POLINK: error: Unresolved external symbol '_SDL_Init'.
POLINK: error: Unresolved external symbol '_SDL_GetError'.
POLINK: error: Unresolved external symbol '_SDL_SetModuleHandle'.
POLINK: error: Unresolved external symbol '_SDL_main'.
POLINK: error: Unresolved external symbol '_SDL_getenv'.
POLINK: fatal error: 8 unresolved external(s).

    Also, I need to know how to set the output to a lib file instead of an exe, and the proper flags for debug and release versions if necesary.

    Then, i think that the project sould be an empty 'Win32 program (EXE)',  adding the include\win\SDL,  lib\win\SDL\SDL.lib and lib\win\SDL\SDLmain.lib to the project for apps with the simulated console main() that it uses.

    Please, a kind hand? ;) References to a good manual would suffice though. :(

runar

  • Guest
Setting up SDL?
« Reply #1 on: June 09, 2011, 12:27:55 PM »
Hello? Some help plz? :'(

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Setting up SDL
« Reply #2 on: June 09, 2011, 04:15:14 PM »
Useful link: http://www.friedspace.com/cprogramming/sdlsetup.php
Here is example project for PellesC 6.5 using cdecl calling conventions.
Can you compile it ?
« Last Edit: June 09, 2011, 04:19:39 PM by timovjl »
May the source be with you