I can't build my project.
I 开发者_JAVA技巧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. The "Project" menu has both "Build All" and "Build Project" grayed-out, however, so it's impossible to build the project. "Build Automatically" is unchecked. During project creation, I told the wizard to use the Linux gcc(1) toolchain. I've been unable to find anything under Project->Properties or Window->Preferences that enables the "Build Project" feature. The Window->Preferences->Build display shows only one tab labeled "Error Parsers".
How can I enable the "Build Project" command?
When you uncheck the
Project :: Build Automatically
button, then it will show you the option to
Project :: Build All
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. 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.
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. I should have selected the "C Project" wizard and told it not to create a 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.
精彩评论