简体   繁体   English

Eclipse CDT,如何编译单个C ++文件?

[英]Eclipse CDT, How to compile a single C++ file?

I am trying to compile a single file. 我正在尝试编译一个文件。 The project has got an external make-file. 该项目有一个外部文件。 I have turned off "Build Automatically". 我已关闭“自动构建”。 Right click on the file, I do see "Build selected File(s)" context menu, but it is disabled (grayed out). 右键单击该文件,我确实看到“构建选定的文件”上下文菜单,但是该菜单被禁用(显示为灰色)。

Would appreciate any help! 将不胜感激!

Did you create the project as a Makefile project? 您是否将该项目创建为Makefile项目?

Open the Makefile in the editor and then select the Outline window (should be on the right). 在编辑器中打开Makefile ,然后选择“ Outline窗口(应在右侧)。 If its not visible open it using menu: Window -> Show View -> Outline . 如果看不见,请使用菜单打开它: Window -> Show View -> Outline While you're there make sure the Make Target view is open with menu: Window ->Show View -> Make Target . 在此期间, Make Target使用以下菜单打开“ Make Target视图: Window ->Show View -> Make Target

In the Outline window you should see the Makefile symbols and targets listed. 在“ Outline窗口中,您应该看到列出的Makefile符号和目标。 Select the targets you want to use (like all and clean ), right click them, then add them to the Make Target window. 选择要使用的目标(如allclean ),右键单击它们,然后将它们添加到Make Target窗口中。

Once they appear in the Make Target window, just double-click on them to invoke make . 它们出现在Make Target窗口中后,只需双击它们即可调用make

Outline window of Makefile : Makefile 轮廓窗口:

在此处输入图片说明

Make Target window. 创建目标窗口。

在此处输入图片说明

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

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