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

Click For Summary

Discussion Overview

The discussion revolves around finding free C or C++ compilers that can create programs for DOS while running on Windows Vista. Participants explore various options for writing and testing code on a modern computer before transferring it to an older DOS machine.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant suggests that any program running in a cmd shell should theoretically run on DOS, provided it does not use OS-dependent libraries, and recommends MinGW and testing in a DOS virtual machine.
  • Another participant recalls using the Watcom C++ compiler, highlighting its support for winmem32 and suggesting that older Microsoft compilers might be available through various online marketplaces.
  • A different reply proposes using Virtual PC to create a DOS environment on Vista if a DOS compiler can be obtained.
  • One participant notes that x64 Windows cannot run 16-bit DOS programs directly, recommending the installation of old compilers on the DOS machine instead.
  • Another contribution emphasizes the need for a compiler that generates real mode code for true DOS compatibility, mentioning Microsoft Visual C++ 1.52 and other alternatives like DJGPP and Borland C++ Compiler 5.5.

Areas of Agreement / Disagreement

Participants express various viewpoints on the best approach to compiling for DOS, with no consensus on a single solution. Multiple competing options and methods are discussed, reflecting differing experiences and preferences.

Contextual Notes

Some suggestions depend on the availability of specific compilers or environments, and there are limitations regarding the compatibility of newer compilers with DOS programs. The discussion also highlights the challenges of running 16-bit applications on modern systems.

technoweasel
Messages
15
Reaction score
0
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.
 
Technology news on Phys.org
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
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
I found it at a page full of http://www.frontiernet.net/~fys/index.htm 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

source page listing other compilers that might work

there's also freedos.org
 
Last edited by a moderator:
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.
 
Last edited by a moderator:
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.
 
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
 

Similar threads

Replies
6
Views
3K
  • · Replies 29 ·
Replies
29
Views
4K
Replies
14
Views
4K
  • · Replies 0 ·
Replies
0
Views
3K
Replies
59
Views
9K
Replies
19
Views
4K
  • · Replies 19 ·
Replies
19
Views
7K
  • · Replies 20 ·
Replies
20
Views
5K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
3
Views
2K