Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

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.

share|improve this answer
    
So could you please make clear what are the basic header files that are required to run a cpp program (basic I/O and so forth) ? And is ncurses package really required as I read elsewhere? –  routeaccess Feb 6 '13 at 12:15
    
updated the answer. –  green7 Feb 6 '13 at 12:19
    
Afaik conio.h is not included in minGW, It is difficult to implement conio.h functions using iostream, so you should use ncurses or similar libraries for this purpose –  Tachyons Feb 6 '13 at 12:59
    
thank you @green7 , the link is quite comprehensive and was one of the things I was looking for. Could you please tell me which package I need to install for the standard library header files to be available? Or is it already in the build-essentials package that I have installed? –  routeaccess Feb 6 '13 at 13:31
    
You don't need to install anything. Just write the program and compile it using g++ –  green7 Feb 6 '13 at 14:28
add comment

conio.h is turbo c++ specific header file, it is not a standard c++ header file

usage #include<headerfile.h> is no longer supported in c++, It is replaced by #include<headerfile>

Eg: use #include<iostream> instead of #include<iostream.h>

You can run turbo c++ in linux using dosbox, But it is highly discouraged, Always use standard syntax while learning a programming language

share|improve this answer
    
#include instead of #include? please review your comment. Thanks. –  routeaccess Feb 6 '13 at 13:51
    
It was an formatting issue, thanks –  Tachyons Feb 6 '13 at 14:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.