TL;DR
You basically have 2 choices on how to proceed. You can either install a package that includes conio.h + its library as I describe below or you can use ncurses.h + its library and swap out and/or remove function calls that depend on it as @Ashish Kulkarni describes in his answer. Either option is viable and is up to the developer/implementer to decide which is the «correct» path.
The conio.h header + library for C/C++ is not something you’ll typically find as being installed by default with most Linux distros. At least not the ones that I’m familiar with Fedora/CentOS/RHEL/Debian/Ubuntu.
NOTE:: Also the use of ncurses.h is not appropriate here either, since that library will likely not include any of the functions that you’re looking for (clrscr(), getch(), etc.) since your .cpp file would seem to be coming from a Windows environment originally.
However you have the option with Linux to install packages from centrally managed repositories. Looking for a package that includes conio.h on my Fedora system I turned up this package. I realize you’re on Ubuntu but on Fedora the package is called libconio that provides exactly the libraries that you’re looking for.
$ yum info libconio.i686
Loaded plugins: auto-update-debuginfo, changelog, langpacks, refresh-packagekit
Available Packages
Name : libconio
Arch : i686
Version : 1.0.0
Release : 3.2
Size : 6.3 k
Repo : rpm-sphere
Summary : Implementation of conio.h functions
License : GPL
Description : libconio is an implementation of conio.h functions that some
: DOS and Windows compilers provide. It's purpose is to allow
: developers to use functions like getch, getche, textcolor and
: others in a linux environment.
Looking on a Ubuntu system I have there’s a similar package called elks-libc that also contains conio.h.
$ apt-cache show elks-libc
Package: elks-libc
Priority: optional
Section: devel
Installed-Size: 651
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Juan Cespedes <cespedes@debian.org>
Architecture: all
Source: linux86
Version: 0.16.17-3.1ubuntu3
Replaces: bcc (<< 0.14.9), linux86
Recommends: bcc (= 0.16.17-3.1ubuntu3)
Conflicts: linux86
Filename: pool/main/l/linux86/elks-libc_0.16.17-3.1ubuntu3_all.deb
Size: 214574
MD5sum: 75d87d8c2c906579ec84624fff93d76d
SHA1: 5cd6d3b9c5a881ad5fcdcffbd5a075761b017731
SHA256: 57bee73becbeae5dc2bc4cd859c13dc065e4a49472d876225e3e37fd6538feb2
Description-en: 16-bit x86 C library and include files
This is the C library used to compile with bcc. It includes all the
headers and static libraries needed to build 16-bit applications,
for Linux/8086, Linux/i386 and DOS .COM executables.
Description-md5: 2da04d6881989db1f4a11df4a992c06f
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 18m
And here’s the file:
$ apt-file list elks-libc | grep conio.h
elks-libc: /usr/lib/bcc/include/conio.h
So you can simply install this package to get the header file + libraries that your application requires to compile.
$ sudo apt-get install elks-libc
NOTE: You may need to adjust your include path to gcc to pick this header file up.
elks-libc is only for 8088 Intel processors
As mentioned in the comments, elks-libc is intended for use on system’s that are targeting the Intel 8088 CPU. You can instead download libconio.h from the SourceForge project titled: Linux c++ implementation of conio.h. You’ll have to install it manually but it shouldn’t be too difficult to do this.
Simple Linux implementation of Borland’s conio (conio.h) library. It uses Ncurses. It includes most functions required to write a basic application using conioh (i.e. getch(), cprintf(), puts() and more).
You can also get the entire libconio project’s source from this SourceForge project titled: libconio and unpack it.
Details on doing this as well as building it and compiling it are covered in this tutorial titled: How to use with GCC.
Содержание
- Fatal error conio h no such file or directory
- Fatal error conio h no such file or directory
- conio.h and iostream: No such file or directory #32
- Comments
- include
- Footer
- conio.h: No such file or directory in linux distribution?
- If you face this types of error then you need to do add the conio.h header file into your computer.
- So how can you do that?
- Fatal error conio h no such file or directory
Fatal error conio h no such file or directory
Im trying to run this code but I get this error!
fatal error: conio.h: No such file or directory
Why are you including ? You don’t use any of the functions contained in that ancient and VERY non-standard header.
Your code formatting looks like a huge plate of cooked pasta and sauce thrown against a wall. ICK! You really should try to make it READABLE.
You didn’t answer my question:
| me wrote: |
|---|
| Why are you including ? |
I doubt I’m gonna like the answer. Probably something along the lines of «I found the code on the internet and don’t know what it is supposed to do.»
Please contradict me.
| TeleMark wrote: |
|---|
| main idea in my question is is to solve the conio.h header file on Linux system |
Main idea in my answer is to convince you that:
(1) Nothing in your code uses conio.h
(2) It’s an ancient, non-standard library used (mainly) for MS-DOS terminals and so not likely to be much use on linux
(3) It’s a waste of time searching for libraries that you aren’t going to use.
Источник
Fatal error conio h no such file or directory
то получаю ошибку «../src/new.cpp:2:19: fatal error: conio.h: Нет такого файла или каталога»
Собственно сам вопрос — откуда мне взять conio.h и куда его подложить? И вообще можно ли сразу где то скачать набор подключаемых файлов что бы в будущем избежать подобных ошибок?
P.S. Да, в данной программе мне не нужна библиотека conio.h, это просто для примера. Такие же проблемы были при попытках подключить файлы Qt. Да и при попытке скомпилировать чужой код как пример, тоже часто такие проблемы. Хотелось бы иметь все библиотеки для работы например в gcc без использования IDE
Судя по информации:
Это старый заголовочный файл и в более-менее новых компиляторах — он просто исключён, а все его функции «перекочевали» в другие заголовочные файлы (типа iostream и другие).
Ты обращай внимание не на заголовочный файл (это не важно- в разных случаях будет разное), а на функции, которые используешь в программе. Скажи, где они (конкретно в твоём случае) описаны? В каких заголовочных файлах? Вот их и подключай.
И что в этом удивительного? Для использование Qt нужно установить Qt + еще Qt это не совсем чистый С++, там свой Meta Object Compiler и т.п.
Ну это уже от конкретного кода зависит. Обычно в ридми описано что нужно.
Источник
conio.h and iostream: No such file or directory #32
Hi, I have a problem with the conio.h and iostream librarys, I can´t run my code, this is the out:
Error 1: «C:UsersMaruGoogle DriveUNADMAtom Programsestacionamiento.c:4:18: fatal error: conio.h: No such file or directory
include
Error 2: «C:UsersMaruGoogle DriveUNADMAtom Programsestacionamiento.c:3:20: fatal error: iostream: No such file or directory
#include
^
compilation terminated.»
What´s happend?, I’ll be very grateful if you help me, thank you! 🙂
The text was updated successfully, but these errors were encountered:
Open a command prompt and enter:
What is the output?
This is the output:
Windows Versión 10.0.10586 2015 Microsoft Corporation. All rights reserved.
C:Windowssystem32>cd C:UsersMaruGoogle DriveUNADMAtom Programs
C:UsersMaruGoogle DriveUNADMAtom Programs>gcc estacionamiento.c
estacionamiento.c:3:20: fatal error: iostream: No such file or directory
#include
^
compilation terminated.
C:UsersMaruGoogle DriveUNADMAtom Programs>.a.exe
«.a.exe» no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
C:UsersMaruGoogle DriveUNADMAtom Programs>gcc estacionamiento.c.a.exe
gcc: error: estacionamiento.c.a.exe: No such file or directory
gcc: fatal error: no input files
compilation terminated.
C:UsersMaruGoogle DriveUNADMAtom Programs>»_
It looks like you’re trying to #include in a C file. Did you mean to make it a C++ file? Change the .c extension to .cpp and use g++ instead of gcc and try again.

© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
conio.h: No such file or directory in linux distribution?
If you face this types of error then you need to do add the conio.h header file into your computer.
So how can you do that?
answer: You need to follow some steps to configure this.
Step-1: Open your terminal and type
Exit fullscreen mode
This will ask you to enter your password.
Step-2: Then you need to install a tool called nautilus. Because this will allow you to open your usr directory as open as administrator mode. So you need to type the following command
Exit fullscreen mode
Close your terminal.
Step-3: Open your file manager.Then open this path. You can find this option bottom left corner in your file manager. 
Select Computer option 
Then you can find root directories 
Go to the usr directory and right click on the include directory then you will find a new option called Open as Administrator 
Select this and this will ask you to enter your password. After that your file manager look like this one 
Then open your terminal and type
Exit fullscreen mode
Then open this link and open raw option 
Then copy those lines of code and paste it in the opening text editor and save it.
Step-4: Copy this file(conio.h) and paste it here 
Источник
Fatal error conio h no such file or directory
The error message from Visual c++:
I dont know if this will work but here is a screenshot:
I don’t remember Windows file names being able to have pluses, nor do I remember there being a conio+ header. :/
Now, it’s true, I haven’t been on that system in ages. However, I do like to keep an eye on where it’s going. 🙂
What exactly were you hoping to do with that header file?
I think it is possible to have pluses now 🙂
Mainly using the gotoxy() function. The headers code is
For the, this is totaly «mumbojumbo», I dont get it, I only know that there are some uses in it, like gotoxy().
I also don’t recognize «conio+.h».
How new are you at this? Sometimes in a class for starters, people just add all of the #includes they can because they don’t know which functions belong to which headers and this keeps your bases covered.
I suggest omitting conio+.h unless you find that a function you need is not defined. Only then should you worry about it.
I see you are using getch() . This is a member of conio.h, so just make sure you keep that one.
. that header is definitely conio. I suspect that «conio+» was just the name of the project to re-implement it using WinAPI functions (despite some of the comments and preprocessor directives, I don’t see any Macintosh functions there).
Just including conio.h should suffice. 😉
To programming as a whole I have been doing things for a while, however to the language c++ I am a new. And I dont get gotoxy() to work with conio.h 🙁 thats my main problem. Is there any other function that is like the same «thing».
Gotoxy() is just what it sounds like, go to cordinates.
Источник
- Печать
Страницы: [1] 2 Все Вниз
Тема: компилятор не находит заголовочный файл conio.h (Прочитано 7730 раз)
0 Пользователей и 1 Гость просматривают эту тему.

tro9an
вот код
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
char dir='a';
int x=10,y=10;
cout << "Нажмите Enter для выхода...n";
while (dir!='r')
{
cout << "nВведите ваши координаты: " << x << ", " << y;
cout << "Выбирете направление (n,s,e,w): ";
dir=getche();
if (dir=='n')
y--;
else
if (dir=='s')
y++;
else
if (dir=='e')
x++;
else
if (dir=='w')
x--;
}
return 0;
}
myproga.cpp:3:19: error: conio.h: Нет такого файла или каталога
myproga.cpp: In function ‘int main()’:
myproga.cpp:13: error: ‘getche’ was not declared in this scope
как это исправить?

arrecck

tro9an
ну вместо getche() написал getchar()
myproga.cpp:12: error: ‘getchar’ was not declared in this scopeчё теперь делать?
насчёт сылки на вику, с++ я только начинаю познавать, там слишком сложна описано

Not eXist
Ну не является библиотека conio стандартной библиотекой C++.

VestniK
ну вместо getche() написал getchar()
myproga.cpp:12: error: ‘getchar’ was not declared in this scopeчё теперь делать?
насчёт сылки на вику, с++ я только начинаю познавать, там слишком сложна описано
Можно подробней где там слишком сложно написано?
Тем не менее, он не является частью языка программирования Си, стандартной библиотеки языка Си, ISO C или требуемой стандартом POSIX.
…
Большинство компиляторов языка Си, предназначенных для UNIX и Linux, не имеют этого файла и не обеспечивают сопутствующих библиотечных функций.
Что именно тут непонятно?

tro9an
ну точто он не является я уже понял, так какой функцией заменить функцию getche() и вообше чё с ней делать если нужна именно она?
вот строка
Члены-функции
после этой строки идёт столбец вот там ппц…

VestniK
Искать в гугле по ключивым словам C getchar Linux. Есть примеры как реализовать эту функцию через ncurses или через UNIX’овые функции работы с терминалом. Помоему даже на жтом форуме были листинги готовых решений. Поиск рулит.

Not eXist
ЕМНИП, getch есть в библиотеке ncurses.

VestniK
вот строка
Члены-функции
после этой строки идёт столбец вот там ппц…
После этой строчки идёт не пипец, а перечисление функций библиотеки conio. Готовся к тому, что это будет в программировании часто встречаться

arrecck
ТС, читать умеешь?
Начал изучать программирование, привыкай, что гуглить придется много и часто
Книжку по с++ для linux скачай, там будет все компилироваться

Yurror

ierofant
Что вы всех людей в гугл отсылаете? По вашему этот сайт был создал как посредник для Google ?
А по вопросу: conio.h это древний заголовочник, был в MS-DOS’е, он не является частью C. Для линукса надо искать иную альтернативу.
Почему бы std::cin не использовать для этих целей?
« Последнее редактирование: 26 Октября 2010, 11:17:07 от ierofant »

VestniK
Что вы всех людей в гугл отсылаете? По вашему этот сайт был создал как посредник для Google?
Потому что надоедает видеть как раз в месяц кто-то, не удосужившись даже потратить 5 минут на поиск, задаёт вопрос который уже обсуждался миллион раз и как мининум 2-3 разных ответа на него можно найти даже на этом форуме не говоря уж о гугле.
Опять же, если человек не научится самостоятельно искать ответы на свои вопросы, то в программировании ему делать нечего. Так что если он самостоятельно найдёт ответ на этот вопрос, то пользы от этого, для него же самого, будет несоизмеримо больше нежели если он тупо получит разжёваный ответ с листингами и примерами здесь.

ierofant
Что вы всех людей в гугл отсылаете? По вашему этот сайт был создал как посредник для Google?
Потому что надоедает видеть как раз в месяц кто-то, не удосужившись даже потратить 5 минут на поиск, задаёт вопрос который уже обсуждался миллион раз и как мининум 2-3 разных ответа на него можно найти даже на этом форуме не говоря уж о гугле.
Опять же, если человек не научится самостоятельно искать ответы на свои вопросы, то в программировании ему делать нечего. Так что если он самостоятельно найдёт ответ на этот вопрос, то пользы от этого, для него же самого, будет несоизмеримо больше нежели если он тупо получит разжёваный ответ с листингами и примерами здесь.
Давайте создадим мегапост «Ищите в гугл» навроде поста «Makefile: как скомпилировать свой первый Hello World». Ибо честное слово, все эти отсылки туда раздражают не меньше чем сами вопросы.

VestniK
Процетирую самого себя:
Опять же, если человек не научится самостоятельно искать ответы на свои вопросы, то в программировании ему делать нечего. Так что если он самостоятельно найдёт ответ на этот вопрос, то пользы от этого, для него же самого, будет несоизмеримо больше нежели если он тупо получит разжёваный ответ с листингами и примерами здесь.
так что отсылки в гугл меня ни капли не раздражают. Я сам не задаю вопрос пока хотя бы часик не поисследовав вопрос самостоятельно. Поэтому вопросов, как правило, не задаю ибо на все мыслемые вопросы ответы уже там есть.
Давайте создадим мегапост «Ищите в гугл» навроде поста «Makefile: как скомпилировать свой первый Hello World».
уже есть: http://maddog.sitengine.ru/smart-question-ru.html
« Последнее редактирование: 26 Октября 2010, 15:41:04 от VestniK »
- Печать
Страницы: [1] 2 Все Вверх
|
artyom5613 0 / 0 / 0 Регистрация: 04.02.2017 Сообщений: 3 |
||||
|
1 |
||||
|
29.10.2017, 11:34. Показов 10510. Ответов 6 Метки нет (Все метки)
Это пример из книжки, и не работает, сижу на Ubuntu в Visual Studio Code, в gcc такая же ошибка. Потом я скачал conio.h(кастом вроде) запихнул в папку с файлом поменял <> на «» и теперь такая ошибка: conio.h:52:21: fatal error: ncurses.h: Нет такого файла или каталога Я как понимаю это из-за Ubuntu, только вот переходить на лагающий Windows не хочется.
__________________
0 |
|
Заклинатель змей 611 / 508 / 213 Регистрация: 30.04.2016 Сообщений: 2,412 |
|
|
29.10.2017, 11:46 |
2 |
|
artyom5613, потому что эти библиотека из прошлого века под MS-DOS. Хотите работать с ним — поставьте себе DOS box и BorlandC
0 |
|
0 / 0 / 0 Регистрация: 04.02.2017 Сообщений: 3 |
|
|
29.10.2017, 12:02 [ТС] |
3 |
|
Добавлено через 1 минуту
artyom5613, потому что эти библиотека из прошлого века под MS-DOS. Хотите работать с ним — поставьте себе DOS box и BorlandC DobroAlex,Книга 2017 года, подробно описано как работать с visual c++, и подразумевается , что conio.h должна работать
0 |
|
Заклинатель змей 611 / 508 / 213 Регистрация: 30.04.2016 Сообщений: 2,412 |
|
|
29.10.2017, 12:43 |
4 |
|
artyom5613, или поставьте Окна и MVS, или Dos
0 |
|
pav1uxa 1943 / 1768 / 825 Регистрация: 23.01.2014 Сообщений: 6,230 |
||||
|
29.10.2017, 13:22 |
5 |
|||
|
artyom5613,
0 |
|
119 / 9 / 2 Регистрация: 06.09.2017 Сообщений: 82 |
|
|
29.10.2017, 16:59 |
6 |
|
Поскажите как быть? Код apt-get install libncurses{,w}5-dev
Код g++ -I. $(pkg-config --cflags ncursesw) main.cpp $(pkg-config --libs ncursesw) Только работать будет криво.
0 |
|
Форумчанин 8193 / 5043 / 1437 Регистрация: 29.11.2010 Сообщений: 13,453 |
|
|
30.10.2017, 14:22 |
7 |
|
artyom5613, conio.h не входит в стандарт и является досовским заголовочным файлом.
0 |
- Forum
- Beginners
- fatal error: conio.h: No such file or di
fatal error: conio.h: No such file or directory
Im trying to run this code but I get this error!
fatal error: conio.h: No such file or directory
|
|
Why are you including
<conio.h>
? You don’t use any of the functions contained in that ancient and VERY non-standard header.
Your code formatting looks like a huge plate of cooked pasta and sauce thrown against a wall. ICK! You really should try to make it READABLE.
|
|
thanks for your help 
You didn’t answer my question:
| me wrote: |
|---|
| Why are you including <conio.h>? |
I doubt I’m gonna like the answer. Probably something along the lines of «I found the code on the internet and don’t know what it is supposed to do.»
Please contradict me.
main idea in my question is is to solve the conio.h header file on Linux system despite the struction of this code, coz I face this problem while using other libraries specially openGL and sfml, but yet I cant find answer on the internet for this problem, I just want to know how to fix (no such file or directory) , thats it
| TeleMark wrote: |
|---|
| main idea in my question is is to solve the conio.h header file on Linux system |
Main idea in my answer is to convince you that:
(1) Nothing in your code uses conio.h
(2) It’s an ancient, non-standard library used (mainly) for MS-DOS terminals and so not likely to be much use on linux
(3) It’s a waste of time searching for libraries that you aren’t going to use.
Topic archived. No new replies allowed.
Looks like no one’s replied in a while. To start the conversation again, simply
ask a new question.
while running C programs an error is thrown by the compiler as following: «relocation.c:3:10: fatal error: ‘conio.h’ file not found» Give me a solution please!!!
MacBook
Pro,
Mac OS X (10.7.4)
Posted on Nov 1, 2012 9:23 AM
1 reply
Question marked as
★
Helpful
Nov 1, 2012 9:33 AM in response to rambruce
If you know how to program in C, the meaning of this error should be obvious. The file references a header file that’s not present in the INCLUDE path.
12 replies
Question marked as
★
Helpful
Nov 1, 2012 9:33 AM in response to rambruce
If you know how to program in C, the meaning of this error should be obvious. The file references a header file that’s not present in the INCLUDE path.
Nov 1, 2012 9:47 AM in response to rambruce
conio.h is an old MS-DOS header file used to create text interfaces and is not used in the modern C standard library. It would seem that you’re trying to compile an old program which probably won’t work without extensive modification.
Regards.
Nov 1, 2012 10:28 AM in response to rambruce
I can’t even begin to tell you. I’d have to study the code you’re trying to compile, and that’s not something I can do here or really am willing to do. Depending on what it is you are trying to build, it could take hours or days to figure out what changes would be needed. If you need help with your code, I’d suggest you find a web site with forums set up for those programming in C and ask for assistance there.
Regards.
Nov 1, 2012 4:58 PM in response to rambruce
Remove conio.h and see what breaks. Then remove that.
Nov 2, 2012 6:33 AM in response to rambruce
If there is any hope at all of anyone here bring able to help you you need to start by telling us what program it is you are trying to compile. Is it somehting you wrote, is it commercial, where did it come from?
Nov 2, 2012 8:28 AM in response to rambruce
You need to use curses instead of conio.h, though you will have to rewrite all the screen handling code.
Nov 2, 2012 10:08 AM in response to Frank Caggiano
Hey! Frank Thanks for your attention and help! the problem is my system does’nt have conio.h header i guess.
I have tried to compile it using CodeRunner,terminal etc but it says ,
fatal error: ‘conio.h’ file not found»
Nov 2, 2012 11:10 AM in response to rambruce
The sample code you are using is either for DOS or Windows. It will not work on a Mac. You can’t make it work. Get some different sample code to try.
Programming issues in C





