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



Hi

On Mon, Mar 19, 2012 at 3:06 PM,  <Raum no-log org> wrote:
Well, I've corrected my command line with -X option :
-------------------------------
valac --pkg sdl -X -lsdl test2.vala
c:/vala-0.12.0/lib/libmingw32.a(main.o):main.c:(.text+0xbd): undefined
reference to `WinMain 16'
collect2: ld returned 1 exit status
error: cc exited with status 1
Compilation failed: 1 error(s), 0 warning(s)
---------------------------------

So I've linked my code with sdl library but I've got the last error
undefined reference to `WinMain 16' for libmingw32.a

Any advice ? :)

Thanks

Hi,

I'm testing Vala and I think I didn't understand how to use package with
it... I want to use SDL and SDLNet but I've got an "undefined
reference"...

Here is my test program :
--------------------
using GLib;
using SDL;

int main (string[] args) {
    SDL.init( 0 );

    SDL.quit( );
    stdout.printf ("Hello world!");
    return 0;
}
--------------------

My command line to compile :
---------------------
valac --pkg sdl test.vala
(...)\LOCALS~1\Temp/cconhiY1.o:test.vala.c:(.text+0x15): undefined
reference to `SDL_Init'
(...)\LOCALS~1\Temp/cconhiY1.o:test.vala.c:(.text+0x1a): undefined
reference to `SDL_Quit'
c:/vala-0.12.0/lib/libmingw32.a(main.o):main.c:(.text+0xbd): undefined
reference to `WinMain 16'
collect2: ld returned 1 exit status
error: cc exited with status 1
Compilation failed: 1 error(s), 0 warning(s)
--------------------

But this sample below just compile without any error with the same command
line :
--------------------------------------
using GLib;
using SDL;

int main (string[] args) {
   stdout.printf ("Hello world!");
   return 0;
}
--------------------------------------

Result :
-----------------------
valac --pkg sdl test2.vala

test2
Hello world!
----------------------

Where am i wrong ?

Thanks !

I forget the exact magic needed for mingw, maybe you need to add -X
-mwindows to the command line?

If not, add --verbose to your vala commandline and post the full gcc
commandline that's being used, that may be useful

Sam



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