C: Function declaration woes
I'm trying to get some mouse-ishness into
some of my programs and was investigating
GPM - I copied this code from a web site and tried to
compile and got errors can anyone give me some insight?
jeff@GONDOR:~/arc/c++$ cat mtest1.c
#include <stdlib.h>
#include <stdio.h>
#include <gpm.h>
int my_handler( Gpm_event *event , void *data ){
printf("Event type : %d at x-%d y-%d\n",
event->type, event->x, event-y);
return 0;
}
int main(){
Gpm_Connect conn;
int c;
conn.eventMask = ~0;
conn.defaultMask = 0;
conn.minMod = 0;
conn.maxMod = ~0;
if(Gpm_Open(&conn, 0) == -1)
printf("Cannot connect to mouse server\n");
gpm_handler = my_handler;
while((c = Gpm_Getc(stdin)) != EOF) printf("%c", c);
Gpm_Close();
return 0;
}
jeff@GONDOR:~/arc/c++$ gcc -lpgm -omtest1 mtest1.c
mtest1.c:4: error: expected ')' before '*' token
mtest1.c: In function 'main':
mtest1.c:18: error: 'my_handler' undeclared (first use in this function)
Thanks,
Jeff
|