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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:38:32  来源:igfitidea点击:

How to setup a makefile in eclipse (C++)?

c++windowsmakefileeclipse-cdt

提问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 Makefilein 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 MSyspackage which includes makealong with other useful tools (recommended),
  • or look into your project's settings under C/C++ Buildand change the build command from maketo mingw32-make, which is distributed as a part of MinGW.
  • 安装MSys包含make其他有用工具的包(推荐),
  • 或者查看您的项目设置C/C++ Build并将构建命令从 更改makemingw32-make,它作为 MinGW 的一部分分发。