How to install Turbo C++ on Windows Vista / 7 x64

| 5 Comments

Hmm…the fact that this post is coming 4 days before my Computer Science practical should be in an indicator to just how serious I’m now getting about my preparation. And rightly so, because even though I may have a certain level of comfort with the syllabus, I still need to give it the full beans. Sort of like one last hurrah.

Anyway, here’s the problem. Turbo C++ (tc.exe) and most other MS-DOS executables are 16-bit programs. And the 64-bit versions of Windows Vista and Windows 7 no longer support 16-bit applications. However, there’s a solution:

  1. Download DOSBox. It’s an 32-bit MS-DOS emulator, which means it can run perfectly fine on 64-bit versions of Windows.|
  2. Download Turbo C++. Preferably, install it to : C:\TC. If you’re not storing it in C:, then call it Z, for the sake of this small tutorial.
  3. Right-click the DOSBox shortcut on your desktop and click on Properties. If the shortcut is missing, create one by copying the shortcut from the Start Menu.

    Edit DOSBox Shortcut Target

  4. In the Properties window, edit the Target text field. It’ll probably read something like this:
    “C:\Program Files (x86)\DOSBox-0.73\dosbox.exe”
    Edit it, so that it now reads like this:
    “C:\Program Files (x86)\DOSBox-0.73\dosbox.exe” -c “mount X Z:” -c “X:” -c “cd TC\bin” -c “tc.exe” conf ““cnf”
    Z is nothing but the drive where you’ve installed Turbo C++. Here, X can be any drive letter you want. Just don’t use the one Windows is installed on (usually C). I’ve chosen L: drive. The above action will ensure that Turbo C++ automatically launched when you double click the shorcut. It does 2 things. First, it mounts Z drive as a virtual drive at X, and then runs tc.exe located under Z:\TC\bin. The conf is just to indicate to DOSBox that the configuration file cnf should be used.
  5. Go to the directory where DOSBox was installed. Usually, it’s going to be

    “C:\Program Files (x86)\DOSBox-0.73”

    Locate the file “CNF”, and open it in a simple text editor, such as Notepad or Wordpad.

    Find the entry for output, and change its value to ‘ddraw’.

    DOSBox Edit Configuration File

    This is because DOSBox has a nasty habit of inverting the colours red and blue when in full screen mode.

  6. In order for Turbo C++ to be able to compile your programs, you’ll need to change the directories within the IDE as well. Launch Turbo C++ using your newly created shortcut. Open the Options menu and select Directories.26032011_tc_edit_directories
  7. In the Directories dialogue box, change the drive letter for each entry to X (or in my case, L)

    26032011_tc_edit_directories_2

  8. Before you compile your first program, you should probably disable DOSBox’s default shortcut for Ctrl+F9. It’s used in TC to compile and run your program, but in DOSBox, it’s used to shutdown DOSBox. So, after editing the directories, close TC, by pressing Alt+X. Then, once back in DOSBox, press Ctrl+F1 to open the keymapper.DOSBox - Edit Keymap

    Select ShutDown next to the the virtual keyboard, and click on Del to delete the binding (notice that mod1 is lighted up, along with F9, that’s because its the keyword for the Ctrl key). Then click Save, and Exit.

  9. Now you can type in tc.exe at the prompt again to fire up Turbo C++ once again, and you’re all set to go. Use Alt-Enter to enter full screen.

EDIT: If you think your PC is getting a bit too hot after running DOSBox, press Alt+Enter to come out of full screen and use Ctrl+F11 and Ctrl+F12 to decrease and increase the virtual computer’s CPU speed accordingly.

Sorry for the departure from the regular blogging, but its something that some people out there might be looking for.

5 Comments

  1. Wow…that works like a Charm tip. Thanks for providing that.

  2. If you wish to avoid the installation process, there’s a file by the name of “turboc_installed.zip” floating around on the internet.

  3. @Bhuwan – Yes. But I couldn’t find it at first, so didn’t bother. ;)

  4. DOSBOX can also be used if you intend to take screenshots of your C++ program and you’ve made use of the graphics library in the program.

  5. That’s true.
    On the negative side, you can’t take text output using PrtScr.

Leave a Reply

Required fields are marked *.

Connect with Facebook

*


More in Tech (2 of 205 articles)