fccm / OCamlSDL2

OCaml interface to SDL 2.0 (for Linux, Windows, MacOS, and ChromeBook)
Other
51 stars 10 forks source link

error: use of undeclared identifier 'int32' #11

Closed xyproto closed 5 years ago

xyproto commented 7 years ago

Hi,

When building on macOS sierra with clang-800.0.42.1 (g++/gcc that comes with the latest version of XCode), I get the following output:

ocamlc -g -ccopt "-static -I/usr/local/include/SDL2 -D_THREAD_SAFE -g -O " sdlsurface_stub.c
sdlsurface_stub.c:193:5: error: use of undeclared identifier 'int32'
    int32 *pixels = (int32 *) SDL_Surface_val(surface)->pixels;
    ^
sdlsurface_stub.c:193:12: error: use of undeclared identifier 'pixels'
    int32 *pixels = (int32 *) SDL_Surface_val(surface)->pixels;
           ^
sdlsurface_stub.c:193:29: error: expected expression
    int32 *pixels = (int32 *) SDL_Surface_val(surface)->pixels;
                            ^
sdlsurface_stub.c:193:22: error: use of undeclared identifier 'int32'
    int32 *pixels = (int32 *) SDL_Surface_val(surface)->pixels;
                     ^
sdlsurface_stub.c:196:28: error: use of undeclared identifier 'pixels'
    return caml_copy_int32(pixels[ofs]);
                           ^
5 errors generated.

This is probably related to the default standard used for C and could probably be fixed by setting something like --std=c89, I guess.

When changing int32 to int32_t, the build gets a bit further, but now errors out with:

make opt byte
ocamlmklib -o sdl2 -oc sdl2_stubs  sdlinit_stub.o  sdlquit_stub.o  sdlrect_stub.o  sdlblendMode_stub.o  sdlsurface_stub.o  sdlwindow_stub.o  sdlrender_stub.o  sdltexture_stub.o  sdlpixelFormat_stub.o  sdlpixel_stub.o  sdlevent_stub.o  sdlkeyboard_stub.o  sdlkeymod_stub.o  sdlmouse_stub.o  sdljoystick_stub.o  sdlclipboard_stub.o  sdltimer_stub.o  sdlgl_stub.o  sdlaudio_stub.o  sdlfilesystem_stub.o  sdlversion_stub.o  sdlcpuinfo_stub.o  sdlpower_stub.o  sdlrwops_stub.o  sdlerror_stub.o  sdl_platform_stub.o -L/usr/local/lib -lSDL2 -lm -liconv -lobjc
ocamlmklib -o sdl2 -oc sdl2_stubs  sdlinit.cmx  sdlquit.cmx  sdlrect.cmx  sdlblendMode.cmx  sdlsurface.cmx  sdlwindow.cmx  sdlrender.cmx  sdltexture.cmx  sdlpixelFormat.cmx  sdlpixel.cmx  sdlevent.cmx  sdlkeyboard.cmx  sdlkeycode.cmx  sdlscancode.cmx  sdlkeymod.cmx  sdlhat.cmx  sdlmouse.cmx  sdljoystick.cmx  sdlclipboard.cmx  sdltimer.cmx  sdlaudio.cmx  sdlfilesystem.cmx  sdlversion.cmx  sdlcpuinfo.cmx  sdlpower.cmx  sdlrwops.cmx  sdlerror.cmx  sdlgl.cmx  sdl.cmx -L/usr/local/lib -lSDL2 -lm -liconv -lobjc
File "_none_", line 1:
Error: sdlinit.cmx

This is with OCaml 4.03.0 and SDL 2.0.5.

Cheers!

fccm commented 5 years ago

Fixed by commit 56b32da updated int32 to Uint32