使用UNIX系统调用编译C程序(= Unix程序??) [英] compile C programs with UNIX system calls (= Unix Programs??)

查看:76
本文介绍了使用UNIX系统调用编译C程序(= Unix程序??)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果C程序有UNIX系统调用,如fork(),alarm(),

等,我们应该把它称为UNIX程序,而不是传统的C程序?


我们无法使用VC ++编译器使用系统调用编译程序。

我需要在UNIX平台下编译它。正确?任何其他的

替代品?


请指教。谢谢!!

解决方案

2005年1月3日星期一 jr ******** @ hotmail.com 写道:

如果C程序有UNIX系统调用,如fork() ,报警(),
等等,我们应该把它称为UNIX程序,而不是传统的C程序?


WHo称他们为C程序?就个人而言,我会调用UNIX程序。

我们无法使用VC ++编译器使用系统调用编译程序。


你有什么期望?在VC ++上编译好的Windoze程序

可能在UNIX上不起作用...

我需要在UNIX平台下编译它。正确?任何其他
替代品?




我不明白这个问题。如果你瞄准某个平台,那么当然你需要编译它。尝试运行(比方说)一个程序

在Solaris上的Windoze上编译将无处可去:你需要在Solaris上编译程序才能编译,如果这就是你的' '目标。


-

Rich Teer,SCNA,SCSA,Solaris Systems Programming的作者


。 * *。 *。*。

。 *。 。*

总统,*。 。 / \(。* *

Rite Online Inc. ./。\。*。

。*。/ * \ ..

。/ * o \。

配音:+1(250)979-1638 *''''''||'''''。

网址: http://www.rite-online.net *** ***************


2005年1月4日星期二03:18:18 GMT,Rich Teer

< ri ******* @ rite-group.com>写道:

2005年1月3日星期一 jr ******** @ hotmail.com 写道:

如果C程序有UNIX系统如fork(),alarm(),
等调用,我们应该把它称为UNIX程序,而不是传统的C程序?
WHo称它们为C程序?就个人而言,我会称之为UNIX程序。




如果他们正在写十分之一的C是他们的C程序,无论他们使用什么库?b $ b恰好使用它们。将它们称为UNIX程序没有人帮助,因为UNIX

计划可以使用任何语言从原始二进制文件写入COBOL。

我们无法使用VC ++编译器使用系统调用编译程序。


您期待什么?在VC ++上编译好的Windoze程序可能在UNIX上不起作用......




很多人不会,很多人会(如果有的话)已经写好了。

我需要在UNIX平台下编译它。正确?任何其他
替代方案??



我不明白这个问题。如果你瞄准某个平台,那么当然你需要编译它。




从未听说过交叉编译器?如果我不得不在目标平台上编译我的程序,手机通常不会支持编译器......

尝试运行(比方说)在Solaris上的Windoze上编译的程序


你的意思是针对Windoze。

将无处可去:如果你正在瞄准的话,你需要编译到Solaris上编程。




或者使用交叉编译器它的目标是Solaris。我有一个,gcc在Windoze的Cygwin下运行

,目标是Sparc机器(以及其他人b / b
目标ARM,M68000和其他平台)。


Chris C


(注释后续内容)


文章< sl ******** **********@ccserver.keris.net>,

Chris Croughton< ch *** @ keristor.net>写道:

2005年1月4日星期二03:18:18 GMT,Rich Teer
< ri ******* @ rite-group.com>写道:

2005年1月3日星期一 jr ******* *@hotmail.com 写道:

如果C程序有UNIX系统调用,如fork(),alarm(),
等,我们应该把它称为UNIX程序,而不是传统的C程序?



为什么称它们为C程序?就个人而言,我会打电话给UNIX程序。


如果它们是用C语言编写的,那么它们就是C程序,无论它们碰巧使用什么库。将它们称为UNIX程序没有人帮助,因为UNIX
程序可以使用任何语言从原始二进制文件写入COBOL。




(从comp.unix.shell读取和发布 - 记住这一点)


顺便提一下,这不是*(好奇地命名)

新闻组comp.lang.c中的视图。


他们维护特定于系统的东西,不管是:


socket(foo,bar,blaz);


或者


lpStr LpHand EXPORT WinPlaceWin(a,b,c);


简单而简单,不是C.

当然,它是什么,他们不会说......


If the C programs have UNIX system calls such as fork(), alarm(),
etc.., we should call it UNIX programs, not traditional C programs?

We couldn''t compile the programs with system calls using VC++ compiler.
I need to compile it under UNIX platform. correct? any other
alternatives??

Please advise. Thanks!!

解决方案

On Mon, 3 Jan 2005 jr********@hotmail.com wrote:

If the C programs have UNIX system calls such as fork(), alarm(),
etc.., we should call it UNIX programs, not traditional C programs?
WHo calls them C programs? Personally, I''d call the UNIX programs.
We couldn''t compile the programs with system calls using VC++ compiler.
What do you expect? Windoze programs that compile fine on VC++
probably won''t work on UNIX...
I need to compile it under UNIX platform. correct? any other
alternatives??



I don''t understand the question. If you''re targeting a certain platform,
then of course you need to compile on it. Trying to run (say) a program
that was compiled on Windoze on Solaris will get you nowhere: you need to
compile to program on Solaris if that is what you''re targeting.

--
Rich Teer, SCNA, SCSA, author of "Solaris Systems Programming"

. * * . * .* .
. * . .*
President, * . . /\ ( . . *
Rite Online Inc. . . / .\ . * .
.*. / * \ . .
. /* o \ .
Voice: +1 (250) 979-1638 * ''''''||'''''' .
URL: http://www.rite-online.net ******************


On Tue, 04 Jan 2005 03:18:18 GMT, Rich Teer
<ri*******@rite-group.com> wrote:

On Mon, 3 Jan 2005 jr********@hotmail.com wrote:

If the C programs have UNIX system calls such as fork(), alarm(),
etc.., we should call it UNIX programs, not traditional C programs?
WHo calls them C programs? Personally, I''d call the UNIX programs.



If they are written in C they are C programs, whatever libraries they
happen to use. Calling them "UNIX programs" helps no one, since a "UNIX
program" could be written in any language from raw binary to COBOL.

We couldn''t compile the programs with system calls using VC++ compiler.



What do you expect? Windoze programs that compile fine on VC++
probably won''t work on UNIX...



Many won''t, many will (if they have been written portably).

I need to compile it under UNIX platform. correct? any other
alternatives??



I don''t understand the question. If you''re targeting a certain platform,
then of course you need to compile on it.



Never heard of a cross-compiler? I would be really stuck if I had to
compile my programs on the target platform, mobile phones usually don''t
support compilers...
Trying to run (say) a program
that was compiled on Windoze on Solaris
You mean "targetted for Windoze".
will get you nowhere: you need to
compile to program on Solaris if that is what you''re targeting.



Or use a cross-compiler which targets Solaris. I have one, gcc running
under Cygwin on Windoze targetting a Sparc machine (and others
targetting ARM, M68000 and other platforms).

Chris C

(Note followups)


In article <sl******************@ccserver.keris.net>,
Chris Croughton <ch***@keristor.net> wrote:

On Tue, 04 Jan 2005 03:18:18 GMT, Rich Teer
<ri*******@rite-group.com> wrote:

On Mon, 3 Jan 2005 jr********@hotmail.com wrote:

If the C programs have UNIX system calls such as fork(), alarm(),
etc.., we should call it UNIX programs, not traditional C programs?



WHo calls them C programs? Personally, I''d call the UNIX programs.



If they are written in C they are C programs, whatever libraries they
happen to use. Calling them "UNIX programs" helps no one, since a "UNIX
program" could be written in any language from raw binary to COBOL.



(Reading and posting from comp.unix.shell - keep that in mind)

This, incidentally, is *not* the view held in the (curiously named)
newsgroup "comp.lang.c".

They maintain that system-specific stuff, be it:

socket(foo,bar,blaz);

or

lpStr LpHand EXPORT WinPlaceWin(a,b,c);

is, plain and simply, not C.

Of course, what it is, they won''t say...


这篇关于使用UNIX系统调用编译C程序(= Unix程序??)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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