eclipse c/c++ CDT 只构建一个文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20023727/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
eclipse c/c++ CDT build just one file
提问by Akronix
I'm doing a C++ project with eclipse CDT but It takes a lot of time building all the source files.
我正在用 eclipse CDT 做一个 C++ 项目,但是构建所有源文件需要很多时间。
I'd prefer just build the one source file which I'm working with until it's correct and later go ahead to the next source file. But all the options I have seen of eclipse (Make project and Build all), work over all the source files of the project.
我宁愿只构建我正在使用的一个源文件,直到它正确为止,然后再继续下一个源文件。但是我所看到的所有 eclipse 选项(Make project 和 Build all)都适用于项目的所有源文件。
Is there any easy way to build just one or two source files in eclipse CDT?
有没有什么简单的方法可以在 eclipse CDT 中构建一两个源文件?
Thank you!
谢谢!
回答by Akronix
It was much easier than expected.
这比预期的要容易得多。
- Deselect Project -> Build Automatically
- Right click on the file you want to build
- Click on Build Selected File(s).
- 取消选择项目 -> 自动构建
- 右键单击要构建的文件
- 单击构建所选文件。
Source: http://www.cesareriva.com/single-file-compile-in-eclipse-cdt/
来源:http: //www.cesareriva.com/single-file-compile-in-eclipse-cdt/
回答by Rox
If you're using makefile project. Simply add '-j n' (n specifies the concurrent job number) into your make parameter.
如果您使用的是 makefile 项目。只需将“-jn”(n 指定并发作业编号)添加到您的 make 参数中。
open 'project properties' -> 'C/C++ Build' -> 'Behavior'(page label) -> 'Build (incremental build'(edit box)
打开“项目属性”->“C/C++ 构建”->“行为”(页面标签)->“构建(增量构建”(编辑框))
e.g. change it to '-j 3 all', will tell make to compile 3 files at same time.
例如将其更改为'-j 3 all',将告诉make 同时编译3 个文件。
Of course, make will detect file dependencies to decide whether the files can be compiled at same time.
当然,make 会检测文件依赖关系来决定文件是否可以同时编译。
cheers
干杯