Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Free C(++) compiler for DOS but runs on Windows

  1. Jan 1, 2010 #1
    Just a quick question. I have tried searching, but Google is fairly useless for me.

    Do any of you know of free C or C++ compilers that can create programs for DOS but run on Windows (specifically, Vista)? I have an old DOS machine but don't want to have to write code on it. Instead, I want to write and test code on my primary computer, recompile it for MS-DOS, and then put it on the old computer. I have had quite a bit of trouble with getting anything to work.

    Any help would be greatly appreciated.
     
  2. jcsd
  3. Jan 3, 2010 #2
    In theory anything that runs in a cmd shell will run on DOS, so long as you don't use os dependent libraries, because the cmd shell is a DOS emulation environment. MinGW and the like and testing in a DOS vm is probably your safest bet. The ms-dos wiki has some paths that look promising.
    http://lists.thedatalist.com/pages/MS_DOS.php [Broken]
    I also found an old MS-DOS programmers usenet group, which makes me think you may want to poke around the msdn sites. Maybe someone still maintains legacy apps?

    Try this: http://www.frontiernet.net/~fys/newbasic.htm [Broken]
    I found it at a page full of http://www.frontiernet.net/~fys/index.htm [Broken] and it seems promising.

    I found one that says it's a c/c++ compiler that works on everything, but requires some specific version of c/c++: http://www.openwatcom.org/index.php/Main_Page [Broken]

    source page listing other compilers that might work

    there's also freedos.org
     
    Last edited by a moderator: May 4, 2017
  4. Jan 3, 2010 #3

    rcgldr

    User Avatar
    Homework Helper

    I used the Watcom C++ compiler back in the days of Windows 3.1. One of it's features was full support of winmem32, allowing 32 bit applications to run on Window 3.1 without requiring the win32s add-on to Windows 3.1. Microsoft's compiler set only provided an assembly listing (not even source) of an example winmem32 app with just two calls, while Watcom did a full implementation, treating winmem32 as a model type (similar small, medium, large models). This was a short lived advantage, as Windows 95 was released within a year or two after winmem32 (winmem32.dll) was made part of Windows 3.x.

    Another alternative would be to find a very old 16 bit Microsoft compiler, perhaps on Amazon or Ebay, or maybe it's available as MSDN. The last version I used was a merge of MSC 8.00c, programers workbench from MSC 7, and Masm 6.11.
     
  5. Jan 4, 2010 #4
    Last edited by a moderator: Apr 24, 2017
  6. Jan 4, 2010 #5
    x64 windows will not run 16 bit dos programs, so you have to use a virtual machine to run the apps.

    There are a lot of old compilers for 16 bit DOS that you can get your hands on, so maybe your best bet is just to install them on the DOS machine, then copy the *.cpp file to the DOS machine, and compile it from there. Visual Studio, for instance, will probably not compile programs that can run on DOS 6.22 without some serious tweaking, but you can save the file and compile it on another machine with a native compiler.
     
  7. Jan 4, 2010 #6

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    If you need it to run on 'real' dos rather than just in a cmd prompt you need a compiler that can generate real mode code

    The last Visual Studio that can do this is Microsoft Visual C++ 1.52, it's a free download if you have an MSDN subscription,

    If you have an extended memory manager you can use 32bit code generated by newer versions of VS or there is a DOS port of gcc (http://www.delorie.com/djgpp/) or there is a free download of Borland C++ Compiler 5.5
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook