Saturday, March 31, 2007

TurboC++ on Linux

Ever tried running TurboC++ on Linux? Hate CBSE for still using such a sucky compiler even though it has gone out of use after 13 years? DosEMU giving nightmares and not working right? DosBOX has come to your rescue.

Seriously, after trying years to make TurboC++ work on DosEMU using various configurations, I finally gave up and tried to use DosBox, something that was originally meant for playing DOS games, but works like a charm for TurboC++.

Anyway, to get TurboC++ working on Linux:

  1. Get Linux: Like, DUH!
  2. Get TurboC++: Get it here
  3. Get DosBOX: Get it here. I've also compiled RPMs for DosBOX on FC5:
    1. SRPM
    2. RPM
    3. debuginfo RPM
  4. Install DosBOX See DosBox documentation on its site
  5. Integrate TurboC++ with DosBOX:
    1. Unzip the TurboC++ zipfile into ~/tc. It will create a directory called tc inside ~/tc. Rename this directory to something like INSTALL or something.
    2. Run DosBOX and the enter the following code:
      mount c ~/tc
      c:
      cd install
      install
      It will show an installation screen. In the first screen, ensure that the source media is C, not A. On the other screen, The Default Works Just Fine™.
    3. When the installation is done, issue the following commands:
      cd \tc\bin
      tc
      This will launch TurboC++. Go to Options->Directories. In Includes, put ";C:\TC\CLASSLIB\INCLUDE" ath the end (without the quotes). In Libraries, put ";C:\TC\CLASSLIB\LIB" at the end (without the quotes). This isn't required, but this allows you to use the predefined classes, like vectors, queues, stacks, lists, string etc., offered by C++. Exit TurboC++
  6. (Optional) Make DosBOX autorun TurboC++:
    Open ~/.dosboxrc in your favourite editor and put the following in it:
    @echo off
    echo Setting default sound mixers
    SET BLASTER=A220 I7 D1 H5 T6
    SET ULTRASND=240,3,3,5,5
    SET ULTRADIR=C:\ULTRASND
    echo Mounting TurboC++ directory as C:
    mount c ~/dosbox
    echo Setting required environment variables
    set FILES=20
    c:
    set PATH=c:/tc/bin;c:/bin;z:/
    echo Running TurboC++
    tc
    @echo Exiting...
    exit

Now, everytime you run DosBOX, it will automatically open up TurboC++. You can create a shortcut or something on the desktop for running DosBOX. Though, as the great thinkers of the 21st century have said, Your Mileage May Vary™.

No comments: