fdopen / opam-repository-mingw

windows package repository for OPAM (mingw and msvc)
https://fdopen.github.io/opam-repository-mingw/
Creative Commons Zero v1.0 Universal
96 stars 33 forks source link

Cannot link with ocamlsdl #47

Closed Chimrod closed 6 years ago

Chimrod commented 6 years ago

Hello,

I'm posting the issue here because I do not known where to find... I'm trying to build a project with ocamlsdl, but the compilation fails at the link stage.

Here is a minimal program

let main () =
        print_endline "START:";
        Sdl.init [`VIDEO];
        Sdlvideo.set_video_mode [];
        Sdltimer.delay 2000;
        Sdl.quit ();
        print_endline "STOP!"

let _ = main ()

and the compilation line : ocamlbuild -pkg sdl test.native give this output : undefined reference to « wWinMain »

.../usr/x86_64-w64-mingw32/sys-root/mingw/lib/libmingw32.a(lib64_libmingw32_a-crt0_w.o) : Dans la fonction « wmain » :
/usr/src/debug/mingw64-x86_64-runtime-5.0.4-1/crt/crt0_w.c:23 : référence indéfinie vers « wWinMain »
collect2: error: ld returned 1 exit status
** Fatal error: Error during linking

The following packages have been installed with the cygwin package manager

Thanks for your help :)

fdopen commented 6 years ago

ocamlsdl probably references the ascii runtime, while recent OCaml verions have switched to the unicode runtime. Try it again with OCaml 4.05.0 or earlier.

Chimrod commented 6 years ago

Switching to 4.05.0 actually works fine. Thanks for answering so fast !