Ubuntu: graphics.h, conio.h and dos.h not working in gcc



Question:

I am working on a project related to mouse programming. I am having a problem that graphics.h, conio.h and dos.h not working in gcc. I tried http://blog.eternal-thinker.com/2010/09/how-to-use-graphicsh-in-ubuntu.html.

When I entered

sudo apt-get install build-essential  

I got:

Reading package lists... Done  Building dependency tree  Reading state information... Done  build-essential is already the newest version.  build-essential set to manually installed.    The following packages were automatically installed and are no longer required:  calligra-l10n-engb cdparanoia k3b k3b-data k3b-i18n kdevelop-l10n    kdevelop-php-docs-l10n kdevelop-php-l10n language-pack-kde-en libflac++6    libk3b6 libkcddb4    Use 'apt-get autoremove' to remove them.    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.  

Then I tried

sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev libsdl1.2debian-all libart-2.0-dev libaudiofile-dev libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev libxext-dev x11proto-xext-dev libfreetype6 libaa1 libaa1-dev libslang2-dev libasound2 libasound2-dev  

and I got the following error:

Reading package lists... Done  Building dependency tree         Reading state information... Done    Package libsdl1.2debian-all is not available, but is referred to by another package.    This may mean that the package is missing, has been obsoleted, or is only available from another source    However the following packages replace it:      libsdl1.2debian    E: Package 'libsdl1.2debian-all' has no installation candidate  

Please help me in using graphics.h, conio.h and dos.h in gcc.


Solution:1

As far as I know, graphics.h is an old obsolete Borland C++ header file for graphics in Ms DOS OS. I think the last Borland C++Builder no longer supported graphics.h. However graphics.h has been simulated for Windows. Executables made using graphics.h usually don't work in newer PCs (and laptops with Windows OS).

(Although graphics.h has simple to use graphical functions, using it is no longer recommended/supported)

Also open source C++ compilers usually do not support conio.h.

conio.h has most functionality in Borland compilers. It's also supported in MS VC++, but with less functionality. conio.h is not supported in gcc, etc.


Solution:2

Embarcadero/Borland has Turbo C version 2 available for download on their website. Since it is a old compiler that runs under DOS you will need to install dosbox in order to use it.

You may wish to start using a modern graphics library such as SDL which will allow you to do graphics/mouse input in Ubuntu.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »