编译大型项目的最佳方式

编程入门 行业动态 更新时间:2024-10-28 13:27:03
本文介绍了编译大型项目的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在一个Linux机器上有一个大项目,可能最终有几个 百''C''源文件,需要编译并链接成几个 可执行文件。 并非所有的可执行文件都会使用所有文件(即某些符号没有 链接器引用)。 该项目自然会被分解为几个或更多 子目录。 问题: a)一般来说构建的最佳方式是什么?将所有的.c文件编译成 对应的.o文件,然后明确地链接.o文件? b)任何想法都可以用 make? c)关于链接器限制的任何想法? 谢谢。

解决方案

" David T. Ashley" < dt*@e3ftwrites:

我在一个Linux机器上有一个大项目,可能最终有几个 ''' C''源文件,需要编译并链接成几个 可执行文件。 并非所有可执行文件都将使用所有文件(即没有 链接器引用某些符号)。 该项目自然会被分解为几个或更多 子目录。 问题: a)一般来说构建的最佳方法是什么?将所有.c文件编译成 对应的.o文件,然后显式链接.o文件?

是的。另一种选择,如果项目很大,子部分以不同的速度发展,那就是制作子项目库(模块)。 另外,它可以更快地构建库并链接几个 程序与这些库的选择,而不是每次都链接所有目标文件中的这些 程序。 (更好的基准测试, 它取决于项目)。

b)任何关于这样做的想法"使" ;?

是的。但请先阅读此内容: members.canb.auug.au/~mil...cons-harm.html ie。只使用一个Makefile。

c)关于链接器限制的任何想法?

无。我脑子里空空如也。对不起。 - __Pascal Bourguignon__ http ://www.informatimago/ 规格适用于弱者和胆怯!

David T. Ashley写道:

我在Linux机器上有一个大型项目,可能最终有几个 百分之一'C ''源文件,需要编译并链接成几个 可执行文件。 并非所有可执行文件都会使用所有文件(即将是没有 链接器引用某些符号)。 该项目自然会被分解为几个或更多 子目录。 问题: a)一般来说构建的最佳方式是什么?将所有的.c文件编译成 对应的.o文件,然后明确地链接.o文件? b)任何想法都可以用 make" ;? c)关于链接器限制的任何想法? 谢谢。

< OT> 你试过Eclipse和CDT吗? www.eclipse/ www.eclipse/cdt/ < / OT>

" David T. Ashley" < dt*@e3ft写在消息中 新闻:nB ******************* @ fe178.usenetserver。 ..

我在Linux机器上有一个大项目,最终可能有几个 百''C''源文件,需要编译并链接到

几个

可执行文件。 并非所有的可执行文件都会使用所有文件(即会有

no

链接器引用某些符号)。 该项目自然会被分解为几个或更多 子目录。 问题: a)一般来说构建的最佳方式是什么?将所有的.c文件编译成 对应的.o文件,然后明确地链接.o文件? b)任何想法都可以用 make? c)关于链接器限制的任何想法? 谢谢。

构建工具不是clc的主题,但你可以先看看 at make。上一次这个董事会的一些人试图回答关于制造的问题。有几个人表示他们已经有了b $ b $ n nlue最好通过搜索和使用你的手册来完成。 << OT>> 如果你有完全安装的开发环境,你可以看看autoconf和automake。但是,它们随附了 警告你应该看一下,这可能会导致你获得更好的工具。 << / OT>>

I have a large project on a Linux box that may eventually have several hundred ''C'' source files, which need to be compiled and linked into several executables. Not all of the executables will use all of the files (i.e. there would be no linker references to some symbols). The project will naturally be broken down into several or more subdirectories. Questions: a)What is the best way in general to build? Compile all the .c files into corresponding .o files, and then link the .o files explicitly? b)Any thoughts on doing this with "make"? c)Any thoughts on the limitations of the linker? Thanks.

解决方案

"David T. Ashley" <dt*@e3ftwrites:

I have a large project on a Linux box that may eventually have several hundred ''C'' source files, which need to be compiled and linked into several executables. Not all of the executables will use all of the files (i.e. there would be no linker references to some symbols). The project will naturally be broken down into several or more subdirectories. Questions: a)What is the best way in general to build? Compile all the .c files into corresponding .o files, and then link the .o files explicitly?

Yes. An alternative, if the project is big, with subparts evolving at different paces, would be to make libraries of subprojects (modules). Also, it could be faster to build the libraries and link several programs with a choice of these libraries, rather than linking these programs from all the object files everytime. (Better benchmark it, it''d depend on the project).

b)Any thoughts on doing this with "make"?

Yes. But read this first: members.canb.auug.au/~mil...cons-harm.html ie. use only one Makefile.

c)Any thoughts on the limitations of the linker?

None. I''ve got an empty brain. Sorry. -- __Pascal Bourguignon__ www.informatimago/ "Specifications are for the weak and timid!"

David T. Ashley wrote:

I have a large project on a Linux box that may eventually have several hundred ''C'' source files, which need to be compiled and linked into several executables. Not all of the executables will use all of the files (i.e. there would be no linker references to some symbols). The project will naturally be broken down into several or more subdirectories. Questions: a)What is the best way in general to build? Compile all the .c files into corresponding .o files, and then link the .o files explicitly? b)Any thoughts on doing this with "make"? c)Any thoughts on the limitations of the linker? Thanks.

<OT> Have you tried Eclipse and CDT? www.eclipse/ www.eclipse/cdt/ </OT>

"David T. Ashley" <dt*@e3ftwrote in message news:nB*******************@fe178.usenetserver. ..

I have a large project on a Linux box that may eventually have several hundred ''C'' source files, which need to be compiled and linked into

several

executables. Not all of the executables will use all of the files (i.e. there would be

no

linker references to some symbols). The project will naturally be broken down into several or more subdirectories. Questions: a)What is the best way in general to build? Compile all the .c files into corresponding .o files, and then link the .o files explicitly? b)Any thoughts on doing this with "make"? c)Any thoughts on the limitations of the linker? Thanks.

Build tools are off topic for clc, but you could start by looking at make. The last time some of the folks on this board tried to respond to a questions about "make" several showed they had noclue Best done by a search and use of your man pages. <<OT>> If you have a fully installed development environment you may take a look at autoconf and automake. But, they come with caveats with you should look at as well, which may lead you to better tools. <</OT>>

更多推荐

编译大型项目的最佳方式

本文发布于:2023-11-23 05:18:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620230.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方式   项目

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!