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

匿名 (未验证) 提交于 2019-12-03 08:39:56

问题:

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).

回答1:

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/



回答2:

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.



回答3:

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

For linux you want the ncurses library.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!