Thread: implicit declaration of int kbhit(...);

  1. #1
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373

    implicit declaration of int kbhit(...);

    I have conio.c included in my file, but i get implicit declaration of int kbhit(...);

    Can someone send me the Kbhit() function? Thanks.

    Oh, i also tried it with conio.h and still got the same thing.
    This war, like the next war, is a war to end war.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Does your compiler support kbhit? If not you'll need to either fake it by using something your compiler does support, or eschew the functionality.
    My best code is written with the delete key.

  3. #3
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    It supports it, as i have done it before the hardrive crashed. Then i get the newer version of the lib to find that KBHIT() isn't even defined.
    This war, like the next war, is a war to end war.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Okay, you've used kbhit, Kbhit, and KBHIT all on the same thread. Are you aware that the function is called kbhit and C++ is case sensitive? Most likely it's something you're doing wrong, compiler vendors don't remove useful functions without mentioning it.
    My best code is written with the delete key.

  5. #5
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    im using kbhit() in the code.

    How do i know that its not defined?

    Because i opened up the conio.c and conio.h files
    This war, like the next war, is a war to end war.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    What compiler do you use?
    My best code is written with the delete key.

  7. #7
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Dev C++ with MinGW GCC
    This war, like the next war, is a war to end war.

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Dev C++ with MinGW GCC
    Works fine for me, what version?
    My best code is written with the delete key.

  9. #9
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    why does that matter?
    I just what the code for the kbhit() fucntion!

    Anyway, the version is:

    2.0.0
    This war, like the next war, is a war to end war.

  10. #10
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    You can't do that. The code in the header files is only declarations, no definitions of functions.

    Try including <mingw_conio.h>

  11. #11
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >2.0.0
    ...Bloodshed is up to version 5. I tested kbhit on 4.9.8.0 and it works just peachy. Maybe you should consider upgrading to a more recent version of this free, downloadable software.
    My best code is written with the delete key.

  12. #12
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    NO NO NO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    I know Bloodsheds Dev C++ is free, and i use 4.9

    The version of MinGW is 2.0.0

    Ill try the Mingw_conio.h
    This war, like the next war, is a war to end war.

  13. #13
    Registered User harryP's Avatar
    Join Date
    Sep 2002
    Posts
    124
    Whoa there killer, simma down. He's just trying to help. I think you'll find that not too many people will be willing to help you if you've got that kind of an attitude.

    Brendan
    Draco dormiens nunquam titallandus.
    Console Graphics Library: http://www.geocities.com/steve_alberto/cgl.html

  14. #14
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Whoa there killer, simma down. He's just trying to help. I think you'll find that not too many people will be willing to help you if you've got that kind of an attitude.
    Prelude is female. Common misconception.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  15. #15
    Registered User harryP's Avatar
    Join Date
    Sep 2002
    Posts
    124
    -Shifty eyes- Eep. Sorry bout that Prelude lol.

    Brendan
    Draco dormiens nunquam titallandus.
    Console Graphics Library: http://www.geocities.com/steve_alberto/cgl.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. NEED HELP READING FILE and PRINTING
    By geoffr0 in forum C Programming
    Replies: 4
    Last Post: 04-16-2009, 05:26 PM
  2. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 12:05 PM
  3. Replies: 2
    Last Post: 03-24-2006, 08:36 PM
  4. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM