make: *** No rule to make target `all'. Stop. Eclipse error

86,461

Solution 1

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.

  1. Go to Project Properties -> C/C++ Build -> Behaviour Tab.
  2. Leave Build (Incremental Build) Checked.
  3. Remove "all" from the text box next to Build (Incremental Build).

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 Etiennebr'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.

Solution 2

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.

Solution 3

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!

Solution 4

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

Solution 5

You should take a look at your makefile (or create one if missing). That's the default 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)
Share:
86,461
chepukha
Author by

chepukha

Updated on May 27, 2020

Comments

  • chepukha
    chepukha almost 4 years

    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?

  • chepukha
    chepukha over 13 years
    Thanks for the help. I've fixed it but don't remember now how exactly it was fixed
  • Franck Dernoncourt
    Franck Dernoncourt about 10 years
    Thanks, yeah personally I always install MinGW before CDT (or other IDEs) so that they can configure themselves (i.e. auto-finding MinGW) when they get installed.
  • Gayal Kuruppu
    Gayal Kuruppu over 3 years
    What if the whole “make file generation” is grayed out?