C是否可从PC移植到UNIX [英] Is C portable from PC to UNIX

查看:56
本文介绍了C是否可从PC移植到UNIX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在像Miracle这样的PC编辑器中编译C源代码,构建它,然后

将.exe带到Unix并在那里运行它吗?

有吗像我这样的初学者加入的首选小组?

Can I compile C source in an PC editor like Miracle, build it, and then
take that .exe over to Unix and run it there?
Is there a preferred group for beginners such as myself to join?

推荐答案



emmitsuks写道:

emmitsuks wrote:
我可以在像Miracle这样的PC编辑器中编译C源代码,构建它,然后将.exe转到Unix并在那里运行吗?


如果您使用交叉编译器并为目标机器构建,那么是。

但是,在x86上为* Windows构建的可执行文件将无法在Unix上本地运行

,特别是如果Unix运行在不同的硬件上(PPC,MIPS,PA-RISC,Sparc等)。

是否有适合初学者的首选组如我自己加入?
Can I compile C source in an PC editor like Miracle, build it, and then
take that .exe over to Unix and run it there?

If you use a cross-compiler and build for the target machine, then yes.
However, an executable built *for* Windows on x86 will not run
natively on Unix, especially if that Unix is running on different
hardware (PPC, MIPS, PA-RISC, Sparc, etc.).

Is there a preferred group for beginners such as myself to join?




如果您的问题是关于C *语言*,那么这就像任何一个好的

组(只是有一些石棉内衣方便) />



If your questions are about the C *language*, then this is as good a
group as any (just have some asbestos underwear handy).


在文章< 11 ********************* @ g44g2000cwa.googlegroups中。 com>,

John Bode< jo ******* @ my-deja.com>写道:
In article <11*********************@g44g2000cwa.googlegroups. com>,
John Bode <jo*******@my-deja.com> wrote:
emmitsuks写道:
emmitsuks wrote:
我可以在像Miracle这样的PC编辑器中编译C源代码,构建它,然后
把它.exe转到Unix并在那里运行?
Can I compile C source in an PC editor like Miracle, build it, and then
take that .exe over to Unix and run it there?


如果您使用交叉编译器并为目标机器构建,那么是。
但是,在x86上为* Windows构建的可执行文件不会在Unix上本地运行,特别是如果Unix运行在不同的硬件上(PPC,MIPS,PA-RISC,Sparc等)。

If you use a cross-compiler and build for the target machine, then yes.
However, an executable built *for* Windows on x86 will not run
natively on Unix, especially if that Unix is running on different
hardware (PPC, MIPS, PA-RISC, Sparc, etc.).




< OT>


的机器上运行Windows x86代码或像Unix这样的系统如bb b b b b b b b b b b b b b b b b b b that that that that that that that that that that that that that that that that that对于非x86

系统,可以使用虚拟机或模拟器,

可以运行x86 Windows代码...可能很慢。


要考虑的一个选择是在Windows上进行开发,但使用

a Unix仿真库,如MingW或AT& T'的UWIN;一旦该代码

正在运行,将-source-带到Unix系统并重建将通常在合理的工作量范围内。但是很少有Unix的味道,所以有时确实会有很多工作,具体取决于你在做什么。


您可以减少端口所需的工作量。从Windows到Unix的程序

,通过C语言限制你自己提供的设施

,并避免图形,GUI,网络或

任何需要了解内部的内容如何系统

做它的工作。这个新闻组,comp.lang.c,经常讨论什么是C语言的内容或者不是C语言的一部分,所以这是一个很好的地方

如果你访问我希望编写的程序可以像实际的那样便携。

-

没有人有权销毁另一个人们的信念是通过要求经验证据来证明。 - Ann Landers



<OT>

Though if you happen to want to run the Windows x86 code on an x86
based machine running any of several Unices or Unix-like systems
such as Linux, then there are free and commercial programs that
apparently do fairly good jobs of running the code. For non-x86
systems there are virtual machines or emulators available that
can run the x86 Windows code... possibly slowly.

One option to consider is to do the development on Windows but using
a Unix emulation library such as MingW or AT&T''s UWIN; once that code
was working, taking the -source- to a Unix system and rebuilding would
usually be within a reasonable amount of work. But there are quite
a few flavour of Unix, so sometimes it does turn out to be a lot of
work, depending exactly what you are doing.

You can reduce the amount of work required to "port" a program
from Windows to Unix, by restricting yourself to the facilities provided
by the C language, and avoiding graphics, GUIs, networking, or
anything that needs to know about the "inside" of how the system
does its work. This newsgroup, comp.lang.c, often has discussions
about what is or is not part of the C language, so it is a good place
to visit if you want to write programs that are intended to be as
portable as practical.
--
"No one has the right to destroy another person''s belief by
demanding empirical evidence." -- Ann Landers


谢谢,我想我应该开始尝试在Unix上熟悉一个

编辑器,比如nano或vi而不是奇迹或视觉c

thanks, I guess I should start trying to familiarize myself with an
editor on Unix like nano or vi instead of miracle or visual c


这篇关于C是否可从PC移植到UNIX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆