简体   繁体   English

Eclipse C / C ++ CDT仅生成一个文件

[英]eclipse c/c++ CDT build just one file

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的选项(进行项目和全部构建)都可以处理该项目的所有源文件。

Is there any easy way to build just one or two source files in eclipse CDT? 有什么简单的方法可以在Eclipse CDT中仅构建一个或两个源文件?

Thank you! 谢谢!

It was much easier than expected. 这比预期容易得多。

  1. Deselect Project -> Build Automatically 取消选择项目->自动构建
  2. Right click on the file you want to build 右键单击要构建的文件
  3. Click on Build Selected File(s) . 点击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/

If you're using makefile project. 如果您使用的是makefile项目。 Simply add '-jn' (n specifies the concurrent job number) into your make parameter. 只需在您的make参数中添加“ -jn”(n指定并发作业号)即可。

open 'project properties' -> 'C/C++ Build' -> 'Behavior'(page label) -> 'Build (incremental build'(edit box) 打开'项目属性'->'C / C ++构建'->'行为'(页面标签)->'构建(增量构建)(编辑框)

eg 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 干杯

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

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