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

In summary, the individual is looking for a free C or C++ compiler that can create programs for DOS but run on Windows Vista. They have an old DOS machine but want to write and test code on their primary computer before compiling it for MS-DOS. They have had trouble finding a suitable compiler and are seeking recommendations. Some suggestions include using MinGW and testing in a DOS virtual machine, checking the MS-DOS wiki and MSDN sites, and using compilers such as OpenWatcom, FreeDOS, or Microsoft Visual C++ 1.52. They also mention the option of using a virtual machine to run the compiler on their Vista machine.
  • #1
technoweasel
15
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
  • #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
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:
  • #3
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.
 
  • #4
Last edited by a moderator:
  • #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.
 
  • #6
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
 

1. What is a free C(++) compiler and why would I need one?

A free C(++) compiler is a program that allows you to write and compile C or C++ code into executable programs on your computer. It is used for creating software, games, and applications. Having a free compiler can save you money and provide you with a powerful tool for programming.

2. Does a free C(++) compiler for DOS also work on Windows?

Yes, a free C(++) compiler for DOS can also run on Windows. This is because DOS and Windows both use the same underlying architecture and can run the same types of programs.

3. Where can I find a free C(++) compiler for DOS that runs on Windows?

There are several websites that offer free C(++) compilers for DOS that also run on Windows. Some popular options include DJGPP, OpenWatcom, and Digital Mars. These can be easily found and downloaded with a simple internet search.

4. Are there any limitations to using a free C(++) compiler for DOS on Windows?

There may be some limitations in terms of compatibility with newer versions of Windows and the availability of certain features. Additionally, some free compilers may have a learning curve for beginners and may not offer as many advanced features as paid compilers. However, for basic programming needs, a free C(++) compiler for DOS should suffice.

5. Are there any alternatives to using a free C(++) compiler for DOS on Windows?

Yes, there are several alternatives to using a free C(++) compiler for DOS on Windows. One option is to use an integrated development environment (IDE) such as Code::Blocks or Dev-C++ which include a compiler and other useful tools for programming. Another option is to use a paid compiler such as Microsoft Visual Studio or Borland C++ which offer more advanced features and support.

Similar threads

Replies
6
Views
1K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
2
Replies
59
Views
5K
  • Programming and Computer Science
Replies
19
Views
3K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
14
Views
1K
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
20
Views
5K
Back
Top