MinGW compile for MS DOS

2019-02-22 03:54发布

I'm using Code::Blocks with MinGW to write my C++ applications in Windows XP. Now I want to compile my code to run under an MS DOS environment, so I can put it on my DOS formatted floppy disc. Can anyone help me?

Thanks in advance.

P.S. I don't mean the Command Prompt, but really the good old MS DOS Operating System.

4条回答
祖国的老花朵
2楼-- · 2019-02-22 04:20

What year was this written??? (Says four months ago.) Uh, no, DJGPP is still supported, it has G++ 4.4.1 (or unofficial 4.4.2, even)!! The libc itself is still being (very slowly) tweaked, but even 2.03p2 "stable" is from 2002 and 2.04 "beta" from 2003. Where did you get year 2000 and GCC 2.96 (never supported by DJGPP, 2.96 wasn't even an official FSF release, it was a Red Hat fork) from????

查看更多
仙女界的扛把子
3楼-- · 2019-02-22 04:26

I have a setup for developing MSDOS programs from Windows 10 (or whatever Windows you want basically), using the Code::Blocks IDE, and the Open Watcom v2 or Digital Mars C/C++ compilers. Code::Blocks has support for these compilers built into it, but the settings will need a bit of tweaking to get it to build correctly for DOS.

OpenWatcomv2

Open Watcom is the easiest to setup with Code::Blocks. Basically, install Open Watcom following the installation instructions on it's site. Then open Code::Blocks and open "settings"->"compiler" select the "Open Watcom (W32) Compiler", go to "toolchain executables" and direct it to the correct executables and directories of Open Watcom.

C/C++ compiler: wcl.exe
Dynamic libs: wlink.exe
Static libs: wlib.exe
Resource compiler: wrc.exe
Make program: wmake.exe

In the "additional paths", make sure you put

"[OpenWatcomDir]/binnt"
"[OpenWatcomDir]/binnt64" 

...assuming you want to use the 64 bit version, see installation instructions otherwise

Also, you will need to go to the "Compiler Options" tab, and right click->modify the option "compile and link for DOS" under the "Executable type options section". You need to add "system dos" in the "linker flags" box, then hit "OK." I believe this is all you need to do in order to start building DOS programs. Just setup a project with the desired compiler options (memory model and such) and you are good to go. You will need an emulator of some kind to test them without booting DOS or something. I recommend 86Box for testing, as it is a very accurate emulator.

查看更多
狗以群分
4楼-- · 2019-02-22 04:36

I haven't developed for MS-DOS for some decades; but I'd start checking the tools used on Free-DOS. Maybe there's already a gcc package for it.

查看更多
来,给爷笑一个
5楼-- · 2019-02-22 04:44

It's pretty old, but DJGPP exists precisely for DOS development. I hasn't been updated since 2000, but it works.

It's basically the same as MinGW, but exclusively for DOS.

查看更多
登录 后发表回答