windows make: *** 没有规则可以使目标“全部”。停止。日食错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3714852/
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
make: *** No rule to make target `all'. Stop. Eclipse error
提问by chepukha
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.
我刚刚下载了适用于 Windows 的 Eclipse CDT 开发人员工具包 (87MB)。我还安装了 MinGW 和 msys。我还将它添加到 PATH:C:\msys\1.0\bin;C:\mingw\bin。并在此之后重新启动计算机。我已经在 cmd 中通过类型“make --version”进行了检查,它可以正常工作。
However, for some reason I cannot compile my C project. I don't get binary files and got only the following things in COnsole:
但是,由于某种原因,我无法编译我的 C 项目。我没有得到二进制文件,在控制台中只有以下内容:
**** 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?
有人可以帮我解决这个问题吗?
回答by drmuelr
For future reference, if you're trying to import an existing project with a makefile...
为了将来参考,如果您尝试使用 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...
如果您的 makefile 没有“全部”规则,此消息仍会弹出。使用“自动生成 Makefile”选项应该会自动处理这个问题。如果你不想为你制作 makefile,你至少有 3 个简单的选择......
Option 1
选项1
If you don't wantto use a rule by that name, use twokats' solution. Here's a clarification.
如果您不想使用该名称的规则,请使用 twokats 的解决方案。这里有一个澄清。
- Go to Project Properties -> C/C++ Build -> Behaviour Tab.
- Leave Build (Incremental Build) Checked.
- Remove "all" from the text box next to Build (Incremental Build).
- 转到项目属性 -> C/C++ 构建 -> 行为选项卡。
- 选中构建(增量构建)。
- 从 Build (Incremental Build) 旁边的文本框中删除“all”。
This lets Eclipse know you aren't trying to use a make target called "all". For some reason, that is the default.
这让 Eclipse 知道您没有尝试使用名为“all”的 make 目标。出于某种原因,这是默认设置。
Option 2
选项 2
Use something similar to Etiennebr's makefile. Note, the all: $(TARGET)
line is the rule that Eclipse is complaining it can't find.
使用类似于 Etiennebr 的 makefile 的内容。请注意,该all: $(TARGET)
行是 Eclipse 抱怨找不到的规则。
Option 3
选项 3
Substitute "all" with a rule name of your choice, and be sure to include that rule in your makefile.
用您选择的规则名称替换“all”,并确保在您的 makefile 中包含该规则。
回答by twokats
Just for your reference, there is a way to configure the CDT build options. I had this same error message (although I didhave a make target - just not named "all") and found this solution (for Galileo + CDT):
仅供参考,有一种方法可以配置 CDT 构建选项。我有同样的错误消息(尽管我确实有一个 make 目标 - 只是没有命名为“all”)并找到了这个解决方案(对于 Galileo + CDT):
Right click your project and choose Properties. The Properties dialog will appear and you should see a C/C++ Buildoption 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 Settingsand Behavior. It is the Behaviortab 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.
右键单击您的项目并选择Properties。将出现“属性”对话框,您应该会看到一个C/C++ 构建选项,您可以在其中设置特定的构建选项。突出显示此项,将出现“属性”页面。选择您要修改的配置,然后在下面的部分中,您应该会看到 2 个选项卡: Builder Settings和Behavior。这是您想要的行为选项卡。在本节中,您可以为构建设置和工作台设置设置首选项,包括指定目标名称(默认为“全部”)或关闭自动构建。
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.
当我开始使用 CDT 时,这对我非常有帮助。我的源代码与构建区域是分开的,在我配置之前,不存在任何生成文件。当我配置时,我的默认目标名称明确为“default”,而不是“all”。在我做任何事情之前让 Eclipse 报告我的项目中的错误很烦人。设置环境以匹配我的开发创造了奇迹。哈。
回答by user2913643
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!
右击项目Properties->C/C++ Build,在“Builder Settings”中勾选“Generate Makefiles automatically”选项,然后选择“Builder type”选项为“Internal builder”,然后点击ok,问题是解决了!
回答by Etienne Racine
You should take a look at your makefile (or create one if missing). That's the default makefile :
您应该查看一下您的 makefile(如果丢失,则创建一个)。这是默认的 makefile :
CXXFLAGS = -O2 -g -Wall -fmessage-length=0
OBJS = main.cpp
LIBS =
TARGET = main.exe
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LIBS)
all: $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
回答by chepukha
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.
我在这个错误上花了很多时间,现在意识到那些没有编译的项目是在我安装MinGW和msys之前创建的,所以之前没有makefile。并且没有包含指向 makefile 的链接的文件夹。这就是我无法编译它的原因。现在,当我创建新项目时,一切正常。
However, I wonder if there is any way to add the path to makefile for the previous projects?
但是,我想知道是否有任何方法可以为以前的项目添加makefile的路径?
Thanks
谢谢