简体   繁体   English

在C ++中构建管理并在Linux上构建良好的IDE

[英]Build management in C++ & good IDEs on Linux

I am starting to write a moderately sized project in C++ requiring a fairly large amount of files and dependencies on other projects. 我开始用C ++编写一个中等大小的项目,需要相当大量的文件和其他项目的依赖项。

Do you think manually maintaining a Makefile for this project is the best approach? 您认为手动维护此项目的Makefile是最好的方法吗?

Are there other better alternatives for C++ that make build management and dependency management of files really easy to handle? 是否还有其他更好的C ++替代品,使文件的构建管理和依赖管理真的很容易处理?

Also, what IDE is good for C++ development on Linux? 什么IDE对Linux上的C ++开发有好处? I am comfortable with Vim, but do you think there are good IDEs for C++ (like Eclipse for Java) that provide code-completion etc? 我对Vim很满意,但你认为有很好的C ++(比如Eclipse for Java)可以提供代码完成等吗?

Thanks! 谢谢! Ajay 阿贾伊

Others have already recommended using CMake. 其他人已经建议使用CMake。 To my mind you should manage your project with CMake then decide on your favourite IDE. 在我看来,您应该使用CMake管理您的项目,然后决定您最喜欢的IDE。

CMake allows you to describe the project to be built, instead of how to build it. CMake允许您描述要构建的项目,而不是如何构建它。 For example: I want to create a shared library called foo with source files a.cpp, b.cpp and ch and it requires these link dependencies. 例如:我想创建一个名为foo的共享库,其源文件是a.cpp,b.cpp和ch,它需要这些链接依赖项。 Then on unix you get libfoo.so and on windows you get foo.dll and foo.lib. 然后在unix上你得到libfoo.so,在windows上你得到foo.dll和foo.lib。 All common project settings can be abstracted up to higher levels in the build tree, this keeps most files very simple. 所有常见项目设置都可以在构建树中抽象到更高级别,这使大多数文件非常简单。 More complicated requirments can be refactored into macros. 更复杂的要求可以重构为宏。

Once your project is described like this CMake will generate makefiles and/or IDE projects. 一旦你的项目被描述为这样,CMake将生成makefile和/或IDE项目。 This means each developer can choose their own IDE, as well as allowing you to mandate an IDE if appropriate. 这意味着每个开发人员都可以选择自己的IDE,并允许您在适当的情况下强制使用IDE。

My company use CMake to build the c++ in our product on windows and solaris. 我的公司使用CMake在我们的windows和solaris产品中构建c ++。 It contains 600 projects and 1.5 million lines of source code. 它包含600个项目和150万行源代码。 We originally chose it as a cross platform build utility when porting to solaris, however for a large project like ours it is much easier to manage the build with CMake than with Visual Studio project files. 我们最初在移植到solaris时选择它作为跨平台构建实用程序,但对于像我们这样的大型项目,使用CMake管理构建要比使用Visual Studio项目文件容易得多。 I would recommend it as a build utility for any c++ project of any size 我建议将它作为任何大小的任何c ++项目的构建实用程序

We use the eclipse cdt on solaris and are very happy with it. 我们在solaris上使用eclipse cdt并且非常满意。 Most of our development is with visual studio on windows. 我们的大多数开发都是在Windows上使用visual studio。 cmake also works well with other ides I use it with KDeveloper4 on linux at home without a hitch. cmake也可以很好地与其他ides一起使用,我在家里的Linux上使用它与KDeveloper4毫不费力。

KDevelop4 (from subversion or rc1 from their site) + CMake makes life so much easier, automake should just die. KDevelop4(来自颠覆或来自他们网站的rc1)+ CMake使生活变得更加轻松,而自动化应该会死亡。 If you want a cross-platform solution, netbeans + the c++ plugin are pretty decent, not as good as kdevelop4 though. 如果你想要一个跨平台的解决方案,netbeans + c ++插件非常不错,不如kdevelop4好。

I suggest you Code::Blocks. 我建议你Code :: Blocks。 I use it on Debian and works gracefully. 我在Debian上使用它并且优雅地工作。

http://www.codeblocks.org/ http://www.codeblocks.org/

Edit: Added another link http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks 编辑:添加了另一个链接http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks

I like CMake a lot for the whole building process (but I have almost no experience with scons or Jam). 我喜欢整个建筑过程中的CMake(但我几乎没有使用scons或Jam的经验)。

I use vim or qtcreator. 我使用vim或qtcreator。 Qtcreator is still in developpment, but very promising I think. Qtcreator仍在开发中,但我认为非常有希望。

Eclipse也做C ++ - 通过eclipse CDT - 不像Java那么全面,但非常好。

Manually maintaining Makefiles in larger Projects becomes quite painful. 在较大的项目中手动维护Makefile变得非常痛苦。 If you start using automake/autoconf, you will - after a while of learning all the facets - appreciate the powerful possibilities these tools can offer. 如果您开始使用automake / autoconf,您将 - 经过一段时间了解所有方面 - 了解这些工具可提供的强大功能。

And as IDE simply use Emacs. 而IDE只使用Emacs。 It's quick, powerful and supports Code completion etc. 它快速,功能强大,支持代码完成等。

There's also Code::Blocks as an IDE with its own building system. 还有Code :: Blocks作为具有自己的构建系统的IDE。 But I would encourage you to try out other build tools (CMake, Boost.Build, SCons) if you want to be able to build your software "anywhere" without having a fancy schmancy IDE installed. 但是,如果您希望能够“无论何时”在任何地方构建软件而不安装花哨的schmancy IDE,我会鼓励您尝试其他构建工具(CMake,Boost.Build,SCons)。 ;-) ;-)

我发现Emacs + Scons对我来说效果很好。

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

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