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

Click For Summary
SUMMARY

Free C and C++ compilers that can create programs for MS-DOS while running on Windows Vista include Open Watcom, Borland C++ Compiler 5.5, and DJGPP. MinGW is recommended for compiling in a DOS emulation environment. Users can also explore legacy compilers available through MSDN or online marketplaces. For optimal results, compilers must generate real mode code to ensure compatibility with DOS 6.22.

PREREQUISITES
  • Understanding of C/C++ programming languages
  • Familiarity with MS-DOS operating system
  • Knowledge of virtual machine software, such as Virtual PC
  • Experience with command line interfaces in Windows
NEXT STEPS
  • Research Open Watcom C/C++ compiler for DOS compatibility
  • Explore DJGPP for DOS port of GCC
  • Investigate legacy compilers available on MSDN or online marketplaces
  • Learn about configuring Virtual PC for running 16-bit applications
USEFUL FOR

Developers looking to compile C/C++ programs for MS-DOS, software engineers working with legacy systems, and anyone interested in maintaining or developing applications for older DOS environments.

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
3K
Replies
14
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
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