简体   繁体   English

为什么“Build Project”在Eclipse Helios CDT中显示为灰色,即使makefile和source存在?

[英]Why is “Build Project” greyed-out in Eclipse Helios CDT even though the makefile and source exist?

I can't build my project. 我无法建立我的项目。

I created a new CDT project in Eclipse Helios and told it to use existing source and makefile -- both, of which, appear correctly in the Package and Project views. 我在Eclipse Helios中创建了一个新的CDT项目并告诉它使用现有的源代码和makefile - 两者都在Package和Project视图中正确显示。 The "Project" menu has both "Build All" and "Build Project" grayed-out, however, so it's impossible to build the project. “Project”菜单“Build All”和“Build Project”都显示为灰色,因此无法构建项目。 "Build Automatically" is unchecked. “自动构建”未选中。 During project creation, I told the wizard to use the Linux gcc(1) toolchain. 在项目创建期间,我告诉向导使用Linux gcc(1)工具链。 I've been unable to find anything under Project->Properties or Window->Preferences that enables the "Build Project" feature. 我一直无法在Project-> Properties或Window-> Preferences下找到启用“Build Project”功能的任何内容。 The Window->Preferences->Build display shows only one tab labeled "Error Parsers". Window-> Preferences-> Build显示只显示一个标签为“Error Parsers”的选项卡。

How can I enable the "Build Project" command? 如何启用“Build Project”命令?

I've discovered the cause of my problem: selecting the wrong "New Project" wizard. 我发现了问题的原因:选择错误的“新建项目”向导。 I selected the "Makefile Project with Existing Code" wizard because the source and makefile already existed. 我选择了“带有现有代码的Makefile项目”向导,因为源和makefile已经存在。 I should have selected the "C Project" wizard and told it not to create a makefile. 我应该选择“C Project”向导并告诉它不要创建一个makefile。 The result of doing the latter is that the "Build Project" entry of the "Project" menu is not grayed-out. 执行后者的结果是“项目”菜单的“构建项目”条目不会显示为灰色。

Apparently, the "Makefile Project with Existing code" is a generic wizard rather than one specific to C/C++ projects. 显然,“带有现有代码的Makefile项目”是一个通用向导,而不是一个特定于C / C ++项目的向导。

This may not be related to your issue if you're using a custom toolchain.... 如果您使用自定义工具链,这可能与您的问题无关....

My experience with eclipse is that it sometimes doesn't quite grok the context of the file in the current editor. 我对eclipse的体验是,它有时候并不能完全理解当前编辑器中文件的上下文。 Have you tried right-clicking the project and selecting build there? 您是否尝试右键单击项目并在那里选择构建? Make sure you choose the actual project and not a source file. 确保选择实际项目而不是源文件。 Also, make sure your source file is recently saved. 此外,请确保最近保存了源文件。

Usually, after I use the method above then the correct "Run As" and "Build" options will appear regardless of the current active editor file. 通常,在使用上述方法后,无论当前的活动编辑器文件如何,都会出现正确的“运行方式”和“构建”选项。 I have this issue with Java, JUnit, C/C++, etc with Helios on Linux. 我在Linux上使用Helios的Java,JUnit,C / C ++等问题。

When you uncheck the 取消选中时

Project :: Build Automatically Project ::自动构建

button, then it will show you the option to 按钮,然后它会显示选项

Project :: Build All Project :: Build All

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

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