2

I'm using clang-7 on 16.04.1-Ubuntu LTS. I get this warning:

warning: implicit declaration of function 'getche' is invalid in C99 
[-Wimplicit-function-declaration]

followed by this error:

error: undefined reference to 'getche'`

What could be wrong?

Here is the link to my code:

https://repl.it/@kallyas/Employees-Record-System

anastaciu
  • 23,467
  • 7
  • 28
  • 53
Kally
  • 324
  • 1
  • 4
  • 12
  • 1
    `getche` is not a standard function I'm aware of , and you don't define it yourself. what function did you want to call? – erik258 Apr 25 '20 at 15:15
  • 1
    `getche` is a Microsoft-specific function which doesn't exist in your compilation environment. – rici Apr 25 '20 at 15:16
  • ```getche()``` to get a single character entered by the user @DanielFarrell – Kally Apr 25 '20 at 15:16
  • It is an extension in Windows MSVC requiring `#include ` but MS also deprecate it in favour of `_getche()` to follow the Standard C rules for implementation-specific names. However, the function is still supported. – Weather Vane Apr 25 '20 at 15:17

1 Answers1

3

getche() is <conio.h> library, therefore it's Windows specific, for alternatives you can look at What is the equivalent to getch() & getche() in Linux?

anastaciu
  • 23,467
  • 7
  • 28
  • 53