45

My Eclipse CDT keeps complaining "make: *** no rule to make target all" when I am trying to compile the piece of code below:

#include <iostream>
using namespace std;

int main() {
  cout << "Hello World!!!" << endl; // prints Hello World!!!
  return 0;
}

Anyone knows how to solve this? I have read the post with the similar title: make: *** No rule to make target `all'. Stop. Eclipse error But none of those answers help...

Thanks a lot!

Community
  • 1
  • 1
Mark Z.
  • 655
  • 2
  • 9
  • 12

11 Answers11

44

You need to change your project settings so that Eclipse-CDT manages your Makefiles for you.

  1. Select Project->Properties from the menu bar.
  2. Click C/C++ Build on the left in the dialog that comes up.
  3. Under the Builder Settings tab on the right, select "Generate Makefiles automatically" under the Makefile generation section.
  4. Hit OK and build again.
ScoPi
  • 1,193
  • 9
  • 14
  • 41
    "Generate Makefiles automatically" is shaded for me! – Mike Vella May 22 '13 at 14:48
  • 1
    If you built your project using an "Existing project with makefile included" my problem was solved earlier today by unchecking "Generate makefiles automatically". Now on my work laptop from home, I get the exact same error, but now it's not working either way. – JoeManiaci May 12 '16 at 02:33
19

"all" is a default setting, even though Behaviour->Build (Incremental build) tab has no variable. I solved as

  1. Go to Project Properties > C/C++ Build > Behaviour Tab.
  2. Leave Build (Incremental Build) Checked.
  3. Enter "test" in the text box next to Build (Incremental Build).
  4. Build Project. You will see error message.
  5. Go back to Build (Incremental Build) and delete "test".
  6. Build Project.
user1146300
  • 279
  • 3
  • 2
13
  1. Select Project->Properties from the menu bar.

  2. Click C/C++ Build on the left in the dialog that comes up.

  3. Under the Builder Settings tab on the right, check and make sure the "Build location" is correct.
raptoravis
  • 145
  • 1
  • 6
10

In C/C++ Build -> Builder Settings, select Internal builder (instead of External builder).

It works for me.

wall-e
  • 7,180
  • 2
  • 16
  • 9
6

I just solved this exact issue for myself; even referenced this question.

I'm assuming you haven't written the "all" rule that Eclipse is complaining about. If this is the case, take these steps:

  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).
  4. Compile away!

This lets Eclipse know you aren't trying to use a make target called "all". For some reason, that is the default.

drmuelr
  • 955
  • 1
  • 13
  • 30
4

You have 2 cases

  • If you create Makefile by yourself, go to
  1. Select Project->Properties from the menu bar.
  2. Click C/C++ Build on the left in the dialog that comes up.
  3. Disable generate makefile automatically -> Under the Builder Settings tab on the right, check and make sure the "Build location" is correct (That location is where your Makefile)
  • If you don't have Makefile -> You need Eclipse DS-5 to help you create Makefile
  1. Select Project->Properties from the menu bar.
  2. Click C/C++ Build on the left in the dialog that comes up.
  3. Enable generate makefile automatically

I advise you create Makefile by your self

Dang_Ho
  • 323
  • 3
  • 11
2

Sometimes if you are making a target via make files double check that all c files are named correctly with correct file structure.

bilalraja
  • 21
  • 2
2

Project -> Clean -> Clean all Projects and then Project -> Build Project worked for me (I did the un-checking generate make-file automatically and then rechecking it before doing this). This was for an AVR (micro-processor programming) project through the AVR CDT plugin in eclipse Juno though.

Demortes
  • 161
  • 11
2

I got this same error after renaming and moving around source files. None of the proposed solutions worked for me and I tracked the error to be the meta-files under Debug directory not being updated. Deleting the entire Debug directory and re-build the project solved the problem for me.

savx2
  • 1,011
  • 2
  • 10
  • 28
0

If the above solutions did not work for you so -

Could be that you did not install C++ compiler packages properly, flow this: (Instructions for Win7, 32bit/64bit)

  1. Make sure you install properly one or more of the supporting C++ compiler packages:

    (I installed MinGW (HowTo Install Videos can be found on YouTube))

    In case you choose to install MinGW packages:

    • Download MinGW installer from the Install Page above
    • Run MinGW installer and make sure to choose the following packages:

      - mingw-developer-toolkit
      - mingw32-base
      - mingw32-gcc-g++
      - msys-base

    • Add MinGW and MSYS bin paths to your PATH environment variable , if you didn't change the default installation folders you should add:

    C:\MinGW\msys\1.0\bin;C:\MinGW\bin;
    • Logoff and log back in for making sure Environment vars kicked in
  2. Create a new C++ project in eclipse:

    • New -> C++ Projects
    • Choose Project type: Executables -> Hello World C++ project
      (Now on the right, under Toolchains you shall see MinGW GCC)
    • Select MinGW GCC from the Toolchains list
    • Hit Finish
  3. In you Hello World Project you shall see + src folder, and + Includes (If so you are probably good to go).

  4. Build project
  5. Run it!
Mercury
  • 7,430
  • 3
  • 42
  • 54
0

Yet another solution:

I got inside objects.mk file

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

USER_OBJS := /home/../mylib.so

LIBS := -lstdc++fs -lGL -lGLU -lGLEW -lglut -lm -lmylib

then didn't read first line. Then altered next line. It was another projects' folder because I copied this using "copy/clone project" feature and this was causing the error for me. I changed myLib.so into /proper_address/reallyMyLib.so and it worked.

Warning: It may harm some unknown places! Backup whole project before doing this. Because it says "do not edit".

huseyin tugrul buyukisik
  • 11,469
  • 4
  • 45
  • 97