Click to See Complete Forum and Search --> : Library for _kbhit


lovish_dhawan
July 25th, 2006, 02:26 AM
Hi All,

I am using Visual Studio 2005, and in my source code i want to use _kbhit as well _getch(). In VC98 it seems that they used to be there in libc.lib. But here as I am using VS2005, please suggest me how to go abt it. I cant use the old libs i.e. libs of VC98.
Please tell which lib contains the definitions of _kbhit and _getch. I have added my build option to be console-app

Thanks in advance

Lovish Dhawan

Krishnaa
July 25th, 2006, 03:09 AM
I think kbhit is still supported, only it's signature is changed to

int _kbhit( void );


So you need to call _kbhit instead of kbhit.
http://msdn2.microsoft.com/en-us/library/58w7c94c.aspx

lovish_dhawan
July 25th, 2006, 03:33 AM
Hi Krishnaa,

Thanks for your quick reply. I am using _kbhit only and not kbhit. I have included conio.h but still getting
error LNK2019: unresolved external symbol _kbhit referenced in function
and thats why not getting a compilation error.
So this mean i need to add a lib which contains its definition.

Thanks

Lovish

VladimirF
July 26th, 2006, 04:25 PM
...this mean i need to add a lib which contains its definition.
According to MSDN (for _kbhit):

Libraries
All versions of the C run-time libraries.

Did you by chance removed default libraries?