Ubuntu – How to compile/run C++ code in the console


I'm trying to run my C++ code using the console. I used the header file conio.h like I did when I used Turbo C++ IDE in Windows, and I ran the code in console using

g++ filename.cpp

I have installed build-essentials Install build-essentials previously, but still I get the message:

conio.h file : No such file or directory

I have poked around a bit and learned that the header files for Windows and Linux differs, but am still to find a way to get all the header files required for basic and intermediate coding practice.

Help on this is appreciated. Please keep in mind that I'm very new to Ubuntu.

Best Answer

conio.h is a library that is windows specific. To my knowledge it comes with mingw32, a compiler that is a windows port of gcc. Try to set up your code so that it doesn't use it.

Also, note that linux uses (99% of the time) the gnu standard library (gnulibc). You can find its content here

For input/output you'd need the iostream (not iostream.h) header file. You can look at a more elaborate and complete list here.