6

I am new user to Ubuntu. I wrote a simple program in C. When I try to compile it to use conio.h, the compiler gives me fatal error. So I tried by ncurses.h, but still I am getting same error.

muru
  • 193,181
  • 53
  • 473
  • 722
amol
  • 81
  • 1
  • 1
  • 4
  • `conio.h` is not present in Linux. You need to use `curses` or `ncurses`. But if you are getting error like`fatal error: curses.h: No such file or directory'`, it means this library is not installed. – g_p Sep 27 '14 at 05:07
  • 2
    Close voters: This most certainly is about using Ubuntu! It is programming related, but not in the sense that would make it off-topic (check the answer below). – Seth Oct 04 '14 at 00:57
  • amol , could you please take some time to review the below answer. Then accept it if that what you were looking for. See http://askubuntu.com/help/someone-answers – user.dz Nov 22 '15 at 12:41
  • I find it amusing that `conio` is a curse word in spanish (afaik) – Marc.2377 Jun 17 '19 at 05:14

1 Answers1

5

Why conio.h Isn't Available

g_p mostly answered this in a comment:

conio.h is not present in Linux. You need to use curses or ncurses. But if you are getting error likefatal error: curses.h: No such file or directory', it means this library is not installed.

For more information on conio.h (and how it's DOS/Windows specific), see the Wikipedia article on it.

Why ncurses.h Wasn't Available, and How To Fix It

As for ncurses, it's necessary to install the libncurses5-dev Install libncurses5-dev (or libncursesw5-dev Install libncursesw5-dev) package, and then pass the -lncurses argument to gcc when compiling, for example:

gcc -Wall -g -o hello hello.c -lncurses

See How do I create simplistic window-like elements in a command-line program? (and its sources) for more information.

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493