Re: [Vala] undefined reference to 'SDL_Init' and/or 'WinMain 16' (under Windows)



Ehm.. I don't have any idea or any clue....

I've tried to create C code and compile it :
-----------------------------------------------------
/* test2.c generated by valac 0.12.0, the Vala compiler
 * generated from test2.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <SDL.h>
#include <stdio.h>

gint _vala_main (gchar** argc, int argc_length1);

gint _vala_main (gchar** argc, int argc_length1) {
        gint result = 0;
        SDL_Init ((guint32) 0);
        SDL_Quit ();
        fprintf (stdout, "Hello world!");
        result = 0;
        return result;
}

int main (int argc, char ** argv) {
        g_type_init ();
        return _vala_main (argv, argc);
}
-------------------------------------------------

And I've got the same error (which is not surprising...) :
gcc -o C:/vala\test2 C:/vala/test2.vala.c -mms-bitfields
-Ic:/vala/include/glib-2.0 -Ic:/vala/lib/glib-2.0/include  -Lc:/vala/lib
-lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lintl -lSDL -lSDLmain -lmingw32
-mwindows
c:/vala/lib/libmingw32.a(main.o):main.c:(.text+0xbd): undefined reference
to `WinMain 16'
collect2: ld returned 1 exit status


Hello,

2012/3/20  <Raum no-log org>:
Perhaps a basic linkage error but I dont know how to correct :D

You should be looking at the SDL FAQ for Windows:
http://wiki.libsdl.org/moin.cgi/FAQWindows

For example this question seems to be exactly what you want (don't
forget -X before each argument):

I get "Undefined reference to 'WinMain 16'"
Under Visual C++, you need to link with SDLmain.lib. Under the gcc
build environments including Dev-C++, you need to link with the output
of "sdl-config --libs", which is usually: -lmingw32 -lSDLmain -lSDL
-mwindows





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]