• Learn how to Run Mac Snow-Leopard on Ubuntu using Oracle Sun Virtual-box
  • Are you a Turbo C++ addict/? Learn how to emulate Turbo c++ with Dos-box in a few steps.
  • Ubuntu's purple love-- A Clean and minimalistic wallpaper for your Desktop.

Turbo c++ on ubuntu using Dosbox





The objective of this article is to help students to run Turbo c++ under Ubuntu (Linux) O/S. 


Turbo c++ is a very widely used compiler for C and C++ in most Indian schools and colleges. Though there are many other compilers like Eclipse CPP (not to be confused for Eclipse IDE for Java), CINT etc.. available for free and offer better useful and interesting IDE features, many schools and colleges are still using Turbo c++ which is an outdated compiler. As students are never exposed to such new technology updates, they are not confident in using latest C++ compilers.

The reason why Turbo C++ cannot run under Ubuntu is  because turbo C++ is built for DOS. But there is a way of doing it. The solution to this problem is using Dosbox, which is a DOS emulator for Linux O/S. Dosbox has a repution of being very light and stable emulator for DOS based programs and was developed with the intension of using it to emulate DOS games and programs on linux systems.

You may be wondering why I chose Dosbox instead of WINE, well thats because wine cannot handle dos programs like Turbo C++, and in my experience wine is  heavy on the system as it is basically meant for Windows based programs.



Steps to get it going

Step 1) INSTALLATION

Run this command in terminal(Ctrl+Alt+T): 

code:

 
sudo apt-get install dosbox
 
Once your done installing Dosbox you will now need the turbo C++ installation file which can be downloaded from here(download).

Unzip the turbo C++ zip folder and place the files in home/your-user-name directory under a folder called setup.

Now open up Dosbox and Type in the below code (in separate lines):

    Code:
mount c ~
c:
cd setup
install.exe 


This will start the setup of  Turbo C++.


Here choose the destination drive as c and source path as setup in the next window.





Select "Start Installation" in the below window.



Turbo C++ is now installed on Dosbox. You may consider checking it by executing the following code on Dosbox (in separate lines):


Code:
c:

cd TC\bin

tc.exe 





Step 2) Creating the configuration file




Run this command in DOSBOX to generate the configuration file which will be stored as: /home/user-name/dosbox.conf
Ensure you enter your system user-name in place of "your-username" in the below code:

code:

config -writeconf /home/your-username/dosbox.conf





Step 3) Creating auto-mount and emulating in fullscreen.





Open dosbox.conf that we created earlier in any text editor, which you will find it under home/your-username, and configure DOSBOX for auto-mount.



Add the following lines at the end of the configuration file as shown in the above highlight.

code:
mount c ~ /home/your-username/
C:
CD TC
CD BIN

Now to set the default screen size to full-screen, find the word fullscreen in the same file (dosbox.conf)  and change its value to true:




Now you are done setting up the configuration file for Dosbox to auto-mount and emulate in fullscreen. Save the file and close it.


Step 4)  Deleting Ctrl+F9 key to avoid shutdown of Dosbox

And in the end you will have to delete a key from the Dosbox keymapper : Ctrl+F9
Since Ctrl+F9 is a Shutdown key in Dosbox you may feel very irritated with it, as the same key is used to compile a program in Turbo C++.

To work-around this issue, open dosbox and hold Ctrl+F1. Now in the window, select the shutdown option on the right hand side bottom, click on delete and then save and exit. This should remove the keymap to Shutdown DOSBOX.




Step 5) Creating Launcher

To make things more convenient, we will create a launcher so that you can run your compiler just by double clicking on it. Here's how you can do it: 


Right click on the desktop and select create launcher.
Name: Turbo c++
command: dosbox -c TC.EXE -c EXIT

Update: For creating launchers on Ubuntu 11.10 follow this post






and now its all set for you to enjoy Turbo C++ on Ubuntu.


Note: Since we have set Dosbox to open in fullscreen you may consider the Alt+Enter key to use it under seamless mode  .
  


If you have any trouble on the installation procedures contact me on www.facebook.com/solancer


54 comments:

Anonymous said...

Very nice.... worked for me!!! thnx :D

sangeet said...

in the step 1 (C:\setup install.exe) dosbox helps following msg...
" THIS PROGRAM MUST B RUN UNDER MICROSOFT WINDOWS "
plz help

AbGet said...

Thanks for this crystal clear howto.

It worked for me like a charm.

Sisay

Anonymous said...

Awesome tutorial, and Thanks a lot for clarifying the ctrl+F9 thing, it helps. :D

CoolPravin said...

Vary Vary thanks .... it work .. cool.... It helps

Anonymous said...

very thanks... its working very cool

javajk said...

it works perfect . thanks

ajinkya said...

yo!!!!!!!!!!!!!!!
wat a nice logic of installation.....
thanxxx....man

Anonymous said...

thanks for the help..... the tip on Ctrl+F9 saved me loads of trouble!!!!!!!!!!!!! :)

this is the first time i installed anything on ubuntu... i sat with my dad and he talked me through it with lotsa help fm here....

now i can practice my sch programs here v easily without going to "hopeless" windows!!!

M

Anonymous said...

it was really very clear dat made me install dosbox so easily n quickly.....THANK U SO MUCH

Anonymous said...

i like it, i got it working ubuntu 11.10 hehehe nice one

Anonymous said...

How to print with Dosbox ?

Anonymous said...

Gr8 work man...made me enjoy Ubuntu along with academics.:):)

rupali said...

unable to change setup.....

Anonymous said...

in the "start installation" step it gives an error 'too many subdirectories'.. plz help

Anonymous said...

Am nevoie de C++ pentru faculta iar compilerele de pe ubuntu nu accepta aceleasi comenzi ca cele de pe windows.
Mersi frumos :)

Unknown said...

nice guide,complete and step by step

Unknown said...

THANX!!!!! :)

Anonymous said...

Really Goooooooooooooooooooooooooooood!!!!!!!!!!!!!!!!!!!

Unknown said...

great sir thanks

Moschops said...

As you stated at the start, Turbo C++ dates from before C++ was standardised. It’s over two decades old. If you use it, you don’t learn C++. You learn some mutant ancestor of C++. There are new, correct C++ compilers available for free. I appreciate that many schools in Asia teach using this ancient tool. It’s insane. Why do people accept it? If people are paying a fortune for this education, why are they happy to learn incorrect, wrong C++ that generally won’t even compile on a correct, modern system?

Anonymous said...

It Works like Magic!

Rudhin said...

It really really helped.

Thank you so much for this explanation sir, thanks a lot.

samruddhi said...

I tried to install TASM the same way you installed Turbo C++ using DOSbox. Well, a problem occurred during the installation. It said 'Too many subdirectories'. What should I do to overcome this problem?

08tm08 said...

Awesome man... Nice work. :)

Unknown said...

Thanks a lot..It is very useful.

Unknown said...

I'm having a problem!!Once i type mount c~,I get a msg saying "The directory has to exist".What to do??

Deepika S said...

Thanks alot :)

@karsh said...

everythings good except for the part where i am unable to create a quick launch icon ..im using ubuntu 12.04 ,..kindly help me out to create a desktop icon

Unknown said...

Just one question why the F**K would you do this when you can install GCC on Ubuntu?

musicenv said...

thx i will get install..

Unknown said...

it is really very useful ..........
Thank u Sir

Unknown said...

thanks dear,its really helpfull.I have a question which one is better either using gcc compiler or dos box.

Unknown said...

installation went butter smooth

Anonymous said...

thankl you:

Manoj Kumar Singh said...

Thanks alot..work well.....

Preet said...

thank you for this walkthrough....step 5 i could not perform can you guide me.

Unknown said...

How do i create a launcher? Other than that everything seems good.

Pratz said...

thank you helped me too :)

Unknown said...
This comment has been removed by the author.
Unknown said...

I am not able to make the launcher.I am able to run by the command given.Can anybody help me out to make the launcher

Sahaj Garg said...

Thanx it helped me a lot.

Unknown said...

unable to change to setup is the message shown when i type cd setup

Rishav Kumar said...

Not working on Ubuntu 17.10
It exits when I open tc.exe.
Please help me out..

Unknown said...

unable to change cd

sameer tiwari said...

PLEASE HELP.
MY KALI LINUX DID NOT CREATE THE dosbox.CONF file. AM STUCK.

Nimesh Sharma said...

Thank you very much!

Unknown said...

just want to thank you a million times.

Merient Infotech said...
This comment has been removed by the author.
Manish Kumar said...

Great step by step guide for C installation.

Thanks, Merient Infotech

Unknown said...

XD

Raheem said...

This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this..

notepad for mac free download

Happiest Society said...

Excelent sir, I was looking for this from a week. Thankyou.

Abdul Baseer said...

How to make shortcut launcher in the Zorin OS 16 Pro?

Post a Comment