make: *** 没有规则可以使目标为“all”。停止。日食错误
我刚刚下载了适用于 Windows 的 Eclipse CDT 开发工具包 (87MB)。我还安装了 MinGW 和 msys。 我还将其添加到 PATH:C:\msys\1.0\bin;C:\mingw\bin。之后重新启动计算机。我已经在 cmd 中通过类型“make --version”进行了检查,它有效。
但是,由于某种原因,我无法编译我的 C 项目。我没有得到二进制文件,并且在 COnsole 中只得到以下内容:
**** Build of configuration Default for project XXX ****
make all
make: *** No rule to make target `all'. Stop.
有人可以帮我解决这个问题吗?
I've just downloaded Eclipse CDT developer kit (87MB) for Windows. I've also installed MinGW, and msys.
I also added this to PATH: C:\msys\1.0\bin;C:\mingw\bin. and restarted computer after that. I've checked by type "make --version" in cmd and it works.
However, for some reason I cannot compile my C project. I don't get binary files and got only the following things in COnsole:
**** Build of configuration Default for project XXX ****
make all
make: *** No rule to make target `all'. Stop.
Could some one help me with this please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
为了将来的参考,如果您尝试使用 makefile 导入现有项目...
如果您的 makefile 没有“all”规则,此消息仍然会弹出。使用“自动生成 Makefiles”选项应该可以自动处理这个问题。如果您不想为您制作 makefile,您至少有 3 个简单的选项...
选项 1
如果您不想使用该名称的规则,使用 twokats 的解决方案。这里有一个澄清。
这让 Eclipse 知道您没有尝试使用名为“all”的 make 目标。由于某种原因,这是默认值。
选项 2
使用类似于 Etienne Racine 的 makefile 的内容。请注意,
all: $(TARGET)
行是 Eclipse 抱怨找不到的规则。选项 3
将“all”替换为您选择的规则名称,并确保将该规则包含在您的 makefile 中。
For future reference, if you're trying to import an existing project with a makefile...
This message will still pop up if your makefile doesn't have an "all" rule. Using the "Generate Makefiles automatically" option should take care of this automatically. If you don't want makefiles made for you, you have at least 3 simple options...
Option 1
If you don't want to use a rule by that name, use twokats' solution. Here's a clarification.
This lets Eclipse know you aren't trying to use a make target called "all". For some reason, that is the default.
Option 2
Use something similar to Etienne Racine's makefile. Note, the
all: $(TARGET)
line is the rule that Eclipse is complaining it can't find.Option 3
Substitute "all" with a rule name of your choice, and be sure to include that rule in your makefile.
仅供参考,有一种方法可以配置 CDT 构建选项。我有同样的错误消息(虽然我确实有一个make目标 - 只是没有命名为“all”)并找到了这个解决方案(对于Galileo + CDT):
右键单击您的项目并选择属性。将出现“属性”对话框,您应该会看到一个 C/C++ 构建 选项,您可以在其中设置特定的构建选项。突出显示此项,将出现“属性”页面。选择您要修改的配置,然后在下面的部分中您应该会看到 2 个选项卡:构建器设置和行为。这是您想要的行为选项卡。在此部分中,您可以设置构建设置和工作台设置的首选项,包括指定目标名称(默认为“all”)或关闭自动构建。
当我开始使用 CDT 时,这对我非常有帮助。我的源代码与构建区域是分开的,在我配置之前,不存在任何 makefile。当我配置时,我的默认目标名称明确为“default”,而不是“all”。在我做任何事情之前,Eclipse 在我的项目中报告错误,这很烦人。设置适合我的发展的环境创造了奇迹。 HTH。
Just for your reference, there is a way to configure the CDT build options. I had this same error message (although I did have a make target - just not named "all") and found this solution (for Galileo + CDT):
Right click your project and choose Properties. The Properties dialog will appear and you should see a C/C++ Build option where you can set specific build options. Highlight this item, and the Properties page will appear. Choose the configuration you wish to modify, and then in the section below that you should see 2 tabs: Builder Settings and Behavior. It is the Behavior tab you want. In this section you can set preferences for build settings and workbench settings, including specifying a target name (default is "all") or turning off automatic builds.
This was incredibly helpful to me when I started using the CDT. My source code is separate from the build area, and until I configure, no makefiles exist. When I configured, my default target name is explicitly "default", not "all". It was annoying to have Eclipse report an error in my project before I did anything. Setting up the environment to match my development worked wonders. HTH.
右键项目Properties->C/C++ Build,在“Builder Settings”中勾选“Generate Makefilesautomatic”选项,然后将“Builder type”选项选择为“Internal builder”,然后点击ok,问题解决解决了!
right click the project Properties->C/C++ Build, in the "Builder Settings" check the "Generate Makefiles automatically" option, and then select the "Builder type" option to "Internal builder", and then click ok, the problem was solved!
我在这个错误上花了很多时间,现在意识到那些未编译的项目是在我安装 MinGW 和 msys 之前创建的,所以之前没有 makefile。并且没有包含指向 makefile 的链接的文件夹。这就是我无法编译它的原因。现在当我创建新项目时,一切都很好。
不过我想知道有没有办法给之前的项目添加makefile的路径呢?
谢谢
I spent a lot of time on this error and now realized that those projects that are not compiled were created before I installed MinGW and msys so there was no makefile before. And there was no include folder with link to the makefile. That's the reason why I could not compile it. Now as I create new project, it's fine.
However, I wonder if there is any way to add the path to makefile for the previous projects?
Thanks
您应该看一下您的 makefile(如果缺少,则创建一个)。这是默认的 makefile :
You should take a look at your makefile (or create one if missing). That's the default makefile :