comp.lang.ada
 help / color / mirror / Atom feed
* Win32 joystick problems
@ 1999-08-15  0:00 Josh Highley
  1999-08-16  0:00 ` David C. Hoos, Sr.
  0 siblings, 1 reply; 2+ messages in thread
From: Josh Highley @ 1999-08-15  0:00 UTC (permalink / raw)


I've been trying to read the position of the joystick using the Win32
bindings included with Gnat 3.11 and AdaGIDE 6.21.  I'm running this under
Win 95.  Since I haven't done any Win32 programming, I created a quick and
simple test program.  However, I can't get it to link.  It compiles okay,
but when I build it, gnatlink returns:

gnatlink -g joytest.ali
./joytest.o: In function 'ada_joytest':
C:/GNAT311/Programs/c:/gnat311/programs/joytest.adb:23: undefined reference
to 'joyGetPos@8'
gnatmake:  *** link failed.

Here's the test program I'm trying to run:
--------------------------------------------------------------
with ada.text_io;
with win32.mmsystem;

use ada.text_io;
use win32.mmsystem;

procedure joytest is

joystick_info : lpjoyinfo;
joyID         : win32.UINT := 1; -- ?? I'm not sure about this value
result        : mmresult;

package mmresult_io is new ada.text_io.modular_io(mmresult);
package UINT_io is new ada.text_io.modular_io(Win32.UINT);
use mmresult_io;
use UINT_io;

begin
     --  This is the function prototype for joyGetPos:
     --   function joyGetPos(
     --                uJoyID: Win32.UINT;
     --                lpji  : LPJOYINFO)
     --               return MMRESULT;
    result := joyGetPos(joyID , joystick_info);
    put("Result: ");
    put(result);
    new_line;
    put("Joystick X-axis: ");
    put(joystick_info.wxpos);
    new_line;
    put("Joystick Y-axis: ");
    put(joystick_info.wypos);
    new_line;
end joytest;
----------------------------------------------------

Like I said, I'm new to Win32 programming so the problem might be obvious to
someone who knows what they are doing.  Any help would be greatly
appreciated.

Thanks,

Josh
joshhighley@hotmail.com






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Win32 joystick problems
  1999-08-15  0:00 Win32 joystick problems Josh Highley
@ 1999-08-16  0:00 ` David C. Hoos, Sr.
  0 siblings, 0 replies; 2+ messages in thread
From: David C. Hoos, Sr. @ 1999-08-16  0:00 UTC (permalink / raw)



Josh Highley <joshhighley@hotmail.com> wrote in message
news:7p82ua$p8r$1@bgtnsc02.worldnet.att.net...
> I've been trying to read the position of the joystick using the Win32
> bindings included with Gnat 3.11 and AdaGIDE 6.21.  I'm running this under
> Win 95.  Since I haven't done any Win32 programming, I created a quick and
> simple test program.  However, I can't get it to link.  It compiles okay,
> but when I build it, gnatlink returns:
>
> gnatlink -g joytest.ali
> ./joytest.o: In function 'ada_joytest':
> C:/GNAT311/Programs/c:/gnat311/programs/joytest.adb:23: undefined
reference
> to 'joyGetPos@8'
> gnatmake:  *** link failed.
>
You need to link with libwinmm.a

There are two ways to do this.  My preferred way is to add the following
pragma, just after the "procedure joytest is" line:
   pragma Linker_Options ("-lwinmm");


The other way is to add -largs -lwinmm  to the gnatmake options
in the GNAT Options in Current Directory menu choice in AdaGIDE.








^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-08-16  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-15  0:00 Win32 joystick problems Josh Highley
1999-08-16  0:00 ` David C. Hoos, Sr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox