g++ conio.h: no such file or directory
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/
Where is the conio.h header file on Linux? Why can't I find conio.h ?
conio.h
is a C header file used with old MS-DOS compilers to create text user interfaces. Compilers that target other operating systems, such as Linux-based, 32-bit Windows and OS/2, provide equivalent functionality through other header files and libraries.
The #include <curses.h>
will give you almost all of the functionality provided by conio.h
.
"ncurses" needs to be installed in the first place.
If you use the Apt package manager:
sudo apt-get install libncurses5-dev libncursesw5-dev
If you use rpm
:
sudo yum install ncurses-devel ncurses
For getch
, take a look at the "NCURSES Programming HOWTO" article.
An error while compiling a C file. fatal error: 'conio.h' file not found
dos.h
is, as the name hints, the MS DOS API provided by Borland for their Turbo C and Turbo C++ compilers. It contains everything you need for MS DOS programming.You need to compile with Turbo C on a MS DOS compatible computer for
that code to run. Some Windows version like Win
95/98 still had MS DOS emulation.conio.h
is a console user interface API, supported at some extent by several other MS DOS compilers.graphics.h
is Borland's fancy EGA graphics library "Borland Graphics Interface". You need a fancy EGA graphics card to run it. And of course, a MS DOS computer with Borland Turbo C. A monitor that supports 16 colors is recommended.
So first you have to download Turbo C from The Borland Museum - Antique Software: Turbo C version 2.01.
After doing so, you need to contact technical museums and ask around if anyone have preserved an ancient computer that you could borrow. Or alternatively, you could spend weeks trying to get some "DOSBox" emulator working on your Mac. You might have to run the DOS emulator in a Windows emulator, I would assume.
Visual Studio Code python.h: No such file or directory windows gcc
The problem was a combinations of simple mistakes and as a beginner I solved it by some digging in gcc -l -L option flags for library link example and gcc arguments docs.
There are several simple and important points that should be observed:
1. The order of options is really important. If its wrong, compiler wont work. It should be like -I(capital i),-g,-L,-l(lower case L),-o.
2. To embed python in C++ firstly the path to python include files have to be known to compiler by -I option. Then the path to python libraries by a -L option. Then name of the each required python .lib file contained in libs folder of python.
Here is an example of it:
"-IC:/Users/MPC/AppData/Local/Programs/Python/Python38-32/include",=>(path to python include files)
"-g",=>(debug option specified by ide)
"${file}",
"-LC:/Users/MPC/AppData/Local/Programs/Python/Python38-32/libs",=>(path to python libraries)
"-lpython38",=>(python lib contained in python libs)
"-lpython3",=>(python lib contained in python libs)
"-l_tkinter",=>(python lib contained in python libs)
"-o",=>(output argument specified by ide)
"${fileDirname}\\${fileBasenameNoExtension}.exe"
I hope that with this answer, the beginners like me, get to the conclusion faster.
There is also a good youtube tutorial of Embedding python in C++ with CMake and Pybind11 and VS Code
Errors when compiling C program with pointers
Mistakes:
conio.h
is not a standard C header. It might be unavailable on your system. Nevertheless, it's not needed for printf(). That's whystdio.h
is here. Remove it, and also remove clrscr(). It won't work without the conio libraries. By doing this, you'll able to compile your file, since the other messages are "just" warnings, not errors.Change your
main()
function's return type toint
and return 0. That's what the C standard specifies. You want this.Use the
%d
format specifier in place of%u
. As the compiler message directly points out, %u is for unsigned integers, andint
is explicitly signed. For integers >= 2 ^ 31, you'll experience strange behavior problems.You're using a wrong specifier one more time. Use
%p
for addresses/pointers, not %u/%d/whatever.Don't explicitly believe/copy-paste from tutorials. Tutorials are not for copy-pasting, they're to be thought of and learnt from.
Fatal error: iostream: No such file or directory in compiling C program using GCC
Neither <iostream>
nor <iostream.h>
are standard C header files. Your code is meant to be C++, where <iostream>
is a valid header. Use a C++ compiler such as clang++
or g++
(and a .cpp
file extension) for C++ code.
Alternatively, this program uses mostly constructs that are available in C anyway. It's easy enough to convert the entire program to compile using a C compiler. Simply remove #include <iostream>
and using namespace std;
, and replace cout << endl;
with putchar('\n');
... I advise compiling using C99, C11 or C18 (eg. gcc -std=c99
, clang -std=c18
etc)
Related Topics
Getting Meteor 0.9.2 Build to Work Osx -> Linux
What Is the Use of Gfp_User Flag in Kmalloc
Initiating Dynamic Variables (Variable Variables) in Bash Shell Script
Linux: Handling a Segmentation Fault and Getting a Core Dump
How to Understand Diff -U in Linux
Ldconfig Only Links Files Starting with Lib*
Perl Fork() Exec() , Child Process Gone Wild
Communicating Between a Parent and Its Children
Awk: Words Frequency from One Text File, How to Ouput into Myfile.Txt
How to Acess the Physical Address from Linux Kernel Space
Having Trouble Finding the Method _Kernel_Vsyscall Within the Linux Kernel
<Command Line>:1:1: Error: MACro Names Must Be Identifiers
Building Opencv as Static Libraries
How to Install a Node.Js Server at Chat.Mydomain.Com on a Hostgator Vps Hosting