多个c文件 [英] Multiple c files

查看:58
本文介绍了多个c文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用任何工具获取包含多个C文件的

组合代码的单个C文件。单个文件应包含头文件的

内容。


first.c

second.c

second.h(包含在first.c中)


我想要一个能结合所有的工具这些文件的内容在

一个文件中

combined.c


现在如果我编译combined.c应该得到与原版相同的结果


希望我很清楚。

提前致谢

解决方案

vi*****@gmail.com (vishal)写在

新闻:2a ************************** @ posting.google.c om:

是否可以使用任何工具来获取包含多个C文件的组合代码的单个C文件。单个文件应该包含头文件的内容。




是的,但这不是一个关于C语言的问题。您可以使用

之类的东西,比如猫和我想的C预处理器。


-

- 标记 - >

-


在''comp.lang.c'中, vi ***** @ gmail.com (vishal)写道:

是否有可能使用任何工具获得单一C文件包含多个C文件的组合代码。单个文件应该包含头文件的内容。

如果我有以下文件的示例:
first.c
second.c
第二.h(包含在first.c中)

我想要一个工具,将这些文件的所有内容组合在一个文件中

combined.c

现在如果我编译combined.c我应该得到与原版相同的结果

希望我很清楚。




我猜你可以用任何体面的文本编辑器做到这一点......你究竟是什么?
点?你也可以通过一些C行自动化操作。


-

-ed-在这里收到我的电子邮件: http://marreduspam.com/ad672570

C语言常见问题解答: http://www.eskimo.com/~scs/C-faq/top .html

C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99

FAQ de fclc: http://www.isty-info.uvsq.fr/~rumeau/fclc/


"维沙尔" < 6 ***** @ gmail.com>在消息中写道

新闻:2a ************************** @ posting.google.c om ...

是否可以使用任何工具获取包含多个C文件的组合代码的单个C文件。单个文件应该包含头文件的内容。

如果我有以下文件的示例:
first.c
second.c
第二.h(包含在first.c中)

我想要一个工具,将这些文件的所有内容组合在一个文件中

combined.c

现在,如果我编译combined.c,我应该得到与原始相同的结果




您通常可以从预处理器输出中间文件。这里的

问题是你的所有宏,并且#defines被解析出来,比如

" #define ESC 27"将代码中的ESC改为27。


Microsoft有几个可以使用的开关:cl / C / EP / u

prog.c> combo.c"


-

Mabden


Is it possible using any tool to get a single C file containing a
combined code of multiple C files. The single file should include the
contents of the header file.

Example if I have following files:
first.c
second.c
second.h(included in first.c)

I want a tool that would combine all the contents of these files in
one file

combined.c

Now if I compile combined.c I should get same result as original

Hope I am clear.
Thanks in advance

解决方案

vi*****@gmail.com (vishal) wrote in
news:2a**************************@posting.google.c om:

Is it possible using any tool to get a single C file containing a
combined code of multiple C files. The single file should include the
contents of the header file.



Yes, but this isn''t really a question about the C language. You could use
things like ''cat'' and the C pre-processor I suppose.

--
- Mark ->
--


In ''comp.lang.c'', vi*****@gmail.com (vishal) wrote:

Is it possible using any tool to get a single C file containing a
combined code of multiple C files. The single file should include the
contents of the header file.

Example if I have following files:
first.c
second.c
second.h(included in first.c)

I want a tool that would combine all the contents of these files in
one file

combined.c

Now if I compile combined.c I should get same result as original

Hope I am clear.



I guess you can do that with any decent text editor... What exactly is your
point ? You also could automate the operation with some lines of C.

--
-ed- get my email here: http://marreduspam.com/ad672570
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/


"vishal" <vi*****@gmail.com> wrote in message
news:2a**************************@posting.google.c om...

Is it possible using any tool to get a single C file containing a
combined code of multiple C files. The single file should include the
contents of the header file.

Example if I have following files:
first.c
second.c
second.h(included in first.c)

I want a tool that would combine all the contents of these files in
one file

combined.c

Now if I compile combined.c I should get same result as original



You can usually output the intermediate file from the pre-processor. The
problem here is all your macros and #defines are parsed out, something like
"#define ESC 27" will be changed to 27 everywhere you had ESC in the code.

Microsoft has a couple of switches you can use like this: "cl /C /EP /u
prog.c > combo.c"

--
Mabden


这篇关于多个c文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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