Hello Evey one,
I'm a fedora beginner and I want to make a program that read extended keys (UP DOWN LEFT RIGHT BUTTONS) in C :
I installed gcc and I can now compile .c applications.
First I had a problem with getch and I read some forums and installed some stuff I can now include curses.h
If I ran the following app as follow :
Code:
gcc testKeys.c -o test -lncurses
I get an immediate output 81 and -1 without pressing any keys
and if i ran it without the -lncurses option I get the following errors
In function `main':
testKeys.c

.text+0xa): undefined reference to `stdscr'
testKeys.c

.text+0x12): undefined reference to `wgetch'
testKeys.c

.text+0x31): undefined reference to `stdscr'
testKeys.c

.text+0x39): undefined reference to `wgetch'
collect2: ld returned 1 exit status
Code:
#include<stdio.h>
#include<curses.h>
int main()
{
char a,gScan;
a = getch();
printf("%d \n",gScan);
gScan = getch();
printf("%d \n",gScan);
switch(gScan)
{
case 72: printf("up \n",gScan);
break;
case 80: printf("down \n",gScan);
break;
case 75: printf("left \n",gScan);
break;
case 77: printf("right \n",gScan);
break;
}
return 0;
}
Can any one help me ????