简体   繁体   English

需要C编译器为Windows 7 64位,编译到DOS目标

[英]Need C compiler for Windows 7 64-bit, to compile to DOS target

I'm trying to find a solution to allow me to compile C code to a DOS executable from Windows 7 64-bit. 我正在尝试找到一个解决方案,允许我将C代码编译为Windows 7 64位的DOS可执行文件。 I recently updated from XP 32-bit to Win7 64-bit, and now my Borland C++ 5.0 compiler won't work. 我最近从XP 32位更新到Win7 64位,现在我的Borland C ++ 5.0编译器无法正常工作。 I get an error when it tries to call tlink.exe 16-bit. 尝试调用16位tlink.exe时出错。 I'm trying to avoid bringing over another computer with XP but that will have to be my course of action if I can't figure something else out soon. 我试图避免使用XP带来另一台计算机,但如果我不能很快找到其他东西,那将是我的行动方案。

My target is an embedded x86 running FreeDOS. 我的目标是运行FreeDOS的嵌入式x86。 As much as I'd like to transition to Linux I can't afford the time that would transition would take. 尽管我想转换到Linux,但我无法承受过渡所需的时间。 Aside from the learning curve of never having used Linux, much of my code is DOS-dependent and would have to be re-written. 除了从未使用过Linux的学习曲线之外,我的大部分代码都依赖于DOS,必须重新编写。

I'm hoping there's a windows setting I can just change but my research so far leads me to believe I need a more drastic change to my process. 我希望有一个窗口设置我可以改变,但到目前为止我的研究让我相信我需要对我的过程进行更大幅度的改变。 I've sniffed around at Turbo C 2.01, DJGPP, DOSbox... not really too confident to go down any of those alleys without some outside input 我已经在Turbo C 2.01,DJGPP,DOSbox上嗤之以鼻......如果没有一些外部输入,我真的没有信心去任何一条小巷

If you can find an old Microsoft Compiler, like 16 bit C / C++ 1.52 (which is included on the 32 bit C / C++ 4.1 cd-rom), or C 8.00 or earlier, it runs using a dos extender or in a 32 bit dos console window. 如果您可以找到旧的Microsoft编译器,如16位C / C ++ 1.52(包含在32位C / C ++ 4.1 cd-rom中)或C 8.00或更早版本,则使用dos扩展程序或32位运行dos控制台窗口。

Why can't you run the Borland compiler using FreeDOS? 为什么不能使用FreeDOS运行Borland编译器?

You could try to create a virtual machine with MSDOS on it, but you'd have to find a way to install MSDOS 6.22 on the virtual machine. 您可以尝试在其上创建具有MSDOS的虚拟机,但您必须找到在虚拟机上安装MSDOS 6.22的方法。 At Microsoft's support site, they have links to a bootable ISO file for MSDOS 6.22. 在Microsoft的支持站点,它们具有指向MSDOS 6.22的可引导ISO文件的链接。 I still have the original floppies and started with those on an old system that has a floppy drive. 我仍然有原始的软盘,并开始使用具有软盘驱动器的旧系统。 It's a bit awkward to import / export files to / from the virtual machine. 将文件导入/导出虚拟机有点尴尬。

This is the config.sys that I use that seems to work with Win 7 virtual machine. 这是我使用的config.sys似乎与Win 7虚拟机一起使用。 I had to increase buffers, stacks, and files to avoid a stack overflow problem with this setup. 我不得不增加缓冲区,堆栈和文件,以避免此设置的堆栈溢出问题。

dos=high,umb
buffers=40,0
files=60
lastdrive=e
shell=c:\command.com c:\ /e:1024 /p
stacks=64,512
switches=/f
device=c:\dos\himem.sys /numhandles:64 /testmem:off
device:c:\dos\emm683.exe ram i=b100-b7ff i=c600-c7ff i=cc00-cfff i=e600-efff frame=d000 a=32 d=128 notr
devicehigh=c:vmadd\cdrom.sys /d:mscd001

This is the autoexec.bat that I use (smartdrv is a bit pointless in this case so I commented it out with "rem" prefix) . 这是我使用的autoexec.bat(在这种情况下smartdrv有点无意义,所以我用“rem”前缀评论它)。

c:\dos\emm386 auto
lh c:\dos\mscdex.exe /d:mscd001 /m:7
rem lh c:\dos\smartdrv.exe
lh c:\vmadd\mouse.com
set path=c:\dos
set blaster=a220 i5 d1 h5 p330 t6
prompt $p$g

Run Virtual XP or VirtualBox and install Borland C++ inside. 运行Virtual XP或VirtualBox并在里面安装Borland C ++。 BTW, there is version 5.02 with some fixes (in case your version is exactly 5.0). BTW,版本5.02有一些修复(如果您的版本正好是5.0)。

As for a compiler, Open Watcom seems to me to be the best choice in your situation. 至于编译器,Open Watcom在我看来是你情况下的最佳选择。 FrameworkPascal (written in the old version of Watcom) provides a 32 bit extender. FrameworkPascal(用旧版Watcom编写)提供了32位扩展器。 Regarding the creation of a FreeDOS virtual machines, pickup the tools from Microsoft SysInteral. 关于创建FreeDOS虚拟机,从Microsoft SysInteral获取工具。 They include a tool that create a VHD. 它们包括一个创建VHD的工具。 Once you get a FreeDOS running in a VM you can simply SYS the VHD and start it anywhere. 一旦你在VM中运行FreeDOS,你就可以简单地SYS VHD并在任何地方启动它。 There are plenty ready to run ISO images for FreeDOS, one worth mentioning is Seagate Seatools for DOS which is being distributed with the FreeDOS kernel. 有足够的准备为FreeDOS运行ISO映像,值得一提的是用于DOS的Seagate Seatools,它与FreeDOS内核一起发布。

Your best (but not only) solution for running all that is probably XPMode on Windows 7 Pro. 运行所有这些的最佳(但不仅仅是)解决方案可能是Windows 7 Pro上的XPMode。 It runs Windows XP 32 which of course provide 100 percent transparent compatibility via its NTVDM with DOS 16 bit real mode, 16 bits protected (Windows 3.1), and DOS 32 bit extenders. 它运行Windows XP 32当然通过其NTVDM与DOS 16位实模式,16位保护(Windows 3.1)和DOS 32位扩展器提供100%透明兼容性。 NTVDM by the way is a feature that can be activated on Windows 10 Pro but it yet to be seen what exactly can be done with it there. 顺便说一下,NTVDM是一个可以在Windows 10 Pro上激活的功能,但还不知道在那里可以用它做什么。

XPMode is a free downnload from Microsoft that installs a free version of Windows XP 32 bit in a virtual machine on Windows 7 Pro with full sharing of the cutpaste/copy buffer, USB, drives, screen and network card (web access). XPMode是Microsoft免费下载的,可在Windows 7 Pro上的虚拟机中安装免费版本的Windows XP 32位,完全共享cutpaste / copy buffer,USB,驱动器,屏幕和网卡(Web访问)。 It can be toggled between a Window and full screen. 它可以在窗口和全屏之间切换。 The installation of XPMode is automated (after activation of the Windows 7 Pro VM). XPMode的安装是自动的(在激活Windows 7 Pro VM之后)。 Microsoft provide various downloadable hot fixes that update the registry to activate the VM. Microsoft提供各种可下载的修补程序,用于更新注册表以激活VM。 There is an MS support downloadable hot fix that has to be run to allow the installation on the AMD Bulldozer architecture. 有一个MS支持可下载的热修复程序必须运行才能在AMD Bulldozer架构上安装。 XPMode hibernate its desktop and virtual hard drives making it a much more productive environment than a hardware based system. XPMode使其桌面和虚拟硬盘处于休眠状态,使其成为比基于硬件的系统更高效的环境。

With a little extra work Windows XP 32 bits can be installed on any virtual machine including Microsoft Virtual Machine on Windows XP 64 bits as well as Oracle Box and VMWare. 通过一些额外的工作,Windows XP 32位可以安装在任何虚拟机上,包括Windows XP 64位上的Microsoft虚拟机以及Oracle Box和VMWare。 XPMode however is probably the smoothest solution since some installations such as MS Virtual Machine for Windows XP 64 bits do not utilized the full physical display in full screen (only about 90 percent of it). 然而,XPMode可能是最顺畅的解决方案,因为某些安装(例如用于Windows XP 64位的MS虚拟机)没有全屏使用完整的物理显示(仅约90%)。 If you install your browser and email in XPMode you can live in the full screen and forget about new versions of Windows. 如果您在XPMode中安装浏览器和电子邮件,则可以全屏显示并忘记Windows的新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM