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

2012-03-26 Thread Joseph Montanez
Sorry I am just now getting to this, but here is my work to get SDL +
Opengl in vala working on windows:
https://github.com/gorilla3d/Hi-Panda/blob/master/Makefile

It was a painful process. You don't need a main or winmain functions
at all. I ended up side loading cygwin, and visual studio libraries
(for opengl). Hopefully that helps enough. I also packaged the
libraries I ended up using with vala-0.12
http://files.myopera.com/sutabi/vala_game_sdk/vala-0.12.0.zip that may
also help.

On Tue, Mar 20, 2012 at 6:27 AM,  r...@no-log.org wrote:
 Really strange...

 This code below is correct and a window appears !
 ==
 using GLib;
 using SDL;

 int WinMain(string[] argc)
 {
        SDL.Surface *screen;

    if( SDL.init( InitFlag.VIDEO )  0 )
    {
        stdout.printf( Impossible d'initialiser SDL:  %s\n,
 SDL.get_error( ) );
        return 1;
    }


    screen = SDL.Screen.set_video_mode( 640, 480, 16,
 SurfaceFlag.HWSURFACE );
        SDL.WindowManager.set_caption (Vala SDL Demo, );

    if( screen == null )
    {
        stdout.printf( Impossible d'initialiser le mode video: %s\n,
 SDL.get_error( ) );
        return 1;
    }

    SDL.Timer.delay( 3000 );
    SDL.quit();
    return 0;
 }


 int main(string[] argc )
 {
                stdout.printf (not printed\n);

                return 0;
 }
 =

 The main function is not called and I've got two warnings :
 Compilation time :
 test2.vala:5.1-5.11: warning: method `WinMain' never used
 int WinMain(string[] argc)

 Linking time :
 Warning: resolving _WinMain@16 by linking to _WinMain

 I need to have these two function main and winmain... :-?

 Ehm...

 Thanks


 Hi
 WinMain usually is the entry point for Win32 programs (isntead of
 main()). If you do not have such a function defined in your C-Code you
 get the
 the error message you described. At least that's the experience I have
 with that error message with pure C an WinAPI

 regards
 andi



 Am 20.03.2012 12:06, schrieb r...@no-log.org:
 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 */
 #includeglib.h
 #includeglib-object.h
 #includestdlib.h
 #includestring.h
 #includeSDL.h
 #includestdio.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/20r...@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

 ___
 vala-list mailing list
 vala-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/vala-list



 ___
 vala-list mailing list
 vala-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/vala-list



-- 
Joseph Montanez
Web Developer
Gorilla3D
Design, Develop, Deploy
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


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

2012-03-20 Thread Raum
Ehm, perhaps I can't use Visual Studio dependencies with MinGW.

I've downloaded these packages :
http://www.libsdl.org/release/SDL-devel-1.2.15-VC.zip

Perhaps I should download (gasp, =__= I didnt notice..)
http://www.libsdl.org/release/SDL-devel-1.2.15-mingw32.tar.gz

I'll try and keep you informed ;) (I need to clean my vala install..)

, Hi

 On Mon, Mar 19, 2012 at 3:06 PM,  r...@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


___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


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

2012-03-20 Thread Raum
Well, I've tried but I've got the same error.

SDL package : SDL-devel-1.2.15-mingw32.tar.gz
(copy files from tarball to directories include, lib and bin).

To correct a -lcom32dlg error, I've installed :
http://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-3.17/w32api-3.17-1-mingw32-dev.tar.lzma/download
(copy files from tarball to directories include, lib and bin).

valac  --pkg sdl -X -lsdl -X -lsdlmain -X -lmingw32 -X -mwindows
--verbose test2.vala
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
error: cc exited with status 1
Compilation failed: 1 error(s), 0 warning(s)

:-?

Thanks :)


 Hello,

 2012/3/20  r...@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


___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


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

2012-03-20 Thread Raum
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  r...@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


___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


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

2012-03-20 Thread Raum
Really strange...

This code below is correct and a window appears !
==
using GLib;
using SDL;

int WinMain(string[] argc)
{
SDL.Surface *screen;

if( SDL.init( InitFlag.VIDEO )  0 )
{
stdout.printf( Impossible d'initialiser SDL:  %s\n,
SDL.get_error( ) );
return 1;
}


screen = SDL.Screen.set_video_mode( 640, 480, 16,
SurfaceFlag.HWSURFACE );
SDL.WindowManager.set_caption (Vala SDL Demo, );

if( screen == null )
{
stdout.printf( Impossible d'initialiser le mode video: %s\n,
SDL.get_error( ) );
return 1;
}

SDL.Timer.delay( 3000 );
SDL.quit();
return 0;
}


int main(string[] argc )
{
stdout.printf (not printed\n);

return 0;
}
=

The main function is not called and I've got two warnings :
Compilation time :
test2.vala:5.1-5.11: warning: method `WinMain' never used
int WinMain(string[] argc)

Linking time :
Warning: resolving _WinMain@16 by linking to _WinMain

I need to have these two function main and winmain... :-?

Ehm...

Thanks


 Hi
 WinMain usually is the entry point for Win32 programs (isntead of
 main()). If you do not have such a function defined in your C-Code you
 get the
 the error message you described. At least that's the experience I have
 with that error message with pure C an WinAPI

 regards
 andi



 Am 20.03.2012 12:06, schrieb r...@no-log.org:
 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 */
 #includeglib.h
 #includeglib-object.h
 #includestdlib.h
 #includestring.h
 #includeSDL.h
 #includestdio.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/20r...@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

 ___
 vala-list mailing list
 vala-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/vala-list



___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


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

2012-03-19 Thread Raum
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 !

Regards

Raum


___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


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

2012-03-19 Thread Sam Thursfield
Hi

On Mon, Mar 19, 2012 at 3:06 PM,  r...@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
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list