windows 如何在 Eclipse (C++) 中设置 makefile?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4239566/
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 setup a makefile in eclipse (C++)?
提问by Amir Rachum
I have a project in Eclipse and I want to use my own makefile. I went to
我在 Eclipse 中有一个项目,我想使用我自己的 makefile。我去了
project -> properties -> C/C++ Build
项目 -> 属性 -> C/C++ 构建
and unchecked "Generate Makfiles Automatically". I have a makefile named Makefile
in the project base dir which just contains:
并取消选中“自动生成 Makfiles”。我Makefile
在项目基本目录中命名了一个 makefile ,它只包含:
all:
g++ *.cpp -o Simulator.exe
When I try to build, I get the following error:
当我尝试构建时,出现以下错误:
Build of configuration MinGW GCC for project CacheOptimization
(Cannot run program "make": Launching failed)
为项目CacheOptimization构建配置MinGW GCC
(无法运行程序“make”:启动失败)
How can I fix this and make eclipse compile my code?
我该如何解决这个问题并使 eclipse 编译我的代码?
采纳答案by cristis
You probably don't have MINGW configured properly, and Eclipse can't run "make". This might be useful: Setting up a compiler
您可能没有正确配置 MINGW,并且 Eclipse 无法运行“make”。这可能很有用:设置编译器
回答by Kos
Either:
任何一个:
- install
MSys
package which includesmake
along with other useful tools (recommended), - or look into your project's settings under
C/C++ Build
and change the build command frommake
tomingw32-make
, which is distributed as a part of MinGW.
- 安装
MSys
包含make
其他有用工具的包(推荐), - 或者查看您的项目设置
C/C++ Build
并将构建命令从 更改make
为mingw32-make
,它作为 MinGW 的一部分分发。