Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

g++ conio.h: no such file or directory

Tags:

linux

g++

I'm trying to write a program with g++ that uses conio.h header. What I'm actually trying to do is calling gotoxy function which I used in Borland compiler and windows OS.

So the first question is: is there a gotoxy function or equivalent in g++?

Second: why can't I include conio.h? I read some stuff that said I should install libstdc++ package, I tried but it seems that I already have it (it's accompanied by gcc).

like image 390
atoMerz Avatar asked Jul 03 '11 22:07

atoMerz


3 Answers

There's no direct equivalent for g++. conio.h is specific to some DOS compilers. But you can get what you want using ncurses library, its functions are similar to ones in conio.h.

Here's a link to a very elaborate tutorial: http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/

like image 172
vines Avatar answered Oct 31 '22 18:10

vines


conio.h is specific to the Windows console environment. Use the curses or ncurses library on Unix; the appropriate function is mvcur() in the low level interface and wmove() in the virtual window interface.

like image 44
geekosaur Avatar answered Oct 31 '22 18:10

geekosaur


Well its not in gcc but it does come with MiniGW. It is specific to Windows.

For linux you want the ncurses library.

like image 2
Mikhail Avatar answered Oct 31 '22 18:10

Mikhail