[vox-tech] getch() c++ linux

Ken Bloom kbloom at gmail.com
Sun Jan 22 18:51:58 PST 2006


Matin Hashemi wrote:
> Anybody knows what's wrong with this code?
> 
> ***************************************
> #include <curses.h>
> #include <stdio.h>
> 
> int main() {
>         int c;
>         for(int i=0;;i++) {
>                 c = getch();
>                 printf("%d : %d\n",i,c);
>         }
> return 0;
> }
> ***************************************
> 
> I can't compile it with g++ 3.2.3 under Redhat Linux:
> 
> /tmp/cc2TgkPL.o(.text+0x1c): In function `main':
> : undefined reference to `stdscr'
> /tmp/cc2TgkPL.o(.text+0x21): In function `main':
> : undefined reference to `wgetch'
> collect2: ld returned 1 exit status

Be sure to link with the ncurses library using the -lncurses switch

-- 
I usually have a GPG digital signature included as an attachment.
See http://www.gnupg.org/ for info about these digital signatures.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://ns1.livepenguin.com/pipermail/vox-tech/attachments/20060122/af0534a9/signature.pgp


More information about the vox-tech mailing list