C++ 如何在 Eclipse 中使用外部 makefile
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2550628/
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
How to use external makefile in Eclipse
提问by Morpheus
I have a source code of an OpenSource project which I get from SVN. I was able to run autogen --> configure --> and make successfully (through the terminal). But I want to build the same project with Eclipse, and I can't port manually those source files to eclipse though. So, How can I set Eclipse to use external make files ? can anyone please help me ? Thanks.
我有一个来自 SVN 的 OpenSource 项目的源代码。我能够运行 autogen --> configure --> 并成功(通过终端)。但是我想用 Eclipse 构建相同的项目,但我无法手动将这些源文件移植到 Eclipse。那么,如何将 Eclipse 设置为使用外部 make 文件?谁能帮帮我吗 ?谢谢。
回答by Morpheus
Ok, I got it, It was straightforward. Just go to project properties --> C/C++ Build --> Make file generation --> and untick "Generate Make files automatically". In additionally you may have to set the Build location also.
好的,我明白了,这很简单。只需转到项目属性 --> C/C++ 构建 --> 生成文件 --> 并取消选中“自动生成生成文件”。此外,您可能还必须设置构建位置。
回答by David Rodríguez - dribeas
This might vary with different versions. The one I use is Eclipse 3.5 with CDT 6, and it is quite straightforward:
这可能因不同版本而异。我使用的是带有 CDT 6 的 Eclipse 3.5,它非常简单:
New Project -> C++ Project -> Makefile Project -> Empty project
新建项目 -> C++ 项目 -> Makefile 项目 -> 空项目
Untick the 'Use default location' and provide the location where the root of your project and Makefile reside.
取消勾选“使用默认位置”并提供项目根目录和 Makefile 所在的位置。
I found it misleading at first, and had a couple of dry runs in copied directories to make sure that the 'Empty project' would not clear the Makefile, but the fact is that the option name is probably misleading as 'Empty' stands for CDT will not create a Makefile for you (but won't delete an existing version either)
起初我发现它具有误导性,并在复制的目录中进行了几次试运行以确保“空项目”不会清除 Makefile,但事实是选项名称可能具有误导性,因为“空”代表CDT不会为您创建 Makefile(但也不会删除现有版本)