drmuelr drmuelr - 1 year ago 170
C++ Question

Eclipse on Ubuntu: No rule to make target `all' error using existing makefile/project

I'm running Eclipse 3.7.2 with CDT installed. Ubuntu 12.04 LTS.

I have an existing makefile C++ project that I'm trying to import from Geany. I can run

$ make
in the project's root directory, and everything builds as expected.

My error in Eclipse:

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

My question: how do I eliminate this error?

Here are the exact steps I'm taking:

  1. File>New>Makefile project with existing code.

    • Existing Code Location set to project's root directory.

    • Languages set to C++

    • Toolchain set to Cross GCC

  2. In Project Properties>C/C++ Build...

    • In Builder Settings...

      • Using default build command

      • NOT using generate makefiles automatically (is unavailable)

    • In Behaviour...

      • Using Build (Incremental build) << all

      • Using Clean << clean

Eclipse CDT: no rule to make target all comes close to answering the problem I'm trying to correct, but I have the same issue as OP: generate makefile automatically is unavailable.

I've tried make: *** No rule to make target `all'. Stop. Eclipse error's top rated solution as well. However, when I uncheck the Build (Incremental Build) option, then build does absolutely nothing, so this isn't right either.

Answer Source

I just figured out the solution. As usual, it should have been obvious.

make: *** No rule to make target `all'. Stop. Eclipse error's top rated answer was right on track, but slightly vague. Here's the solution:

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

The error was being thrown because Eclipse was trying to find a rule to build "all", which was specified as a target by default.

Removing "all" (and leaving everything else as default) tells Eclipse to build the project in the exact same manner that calling $ make from the terminal would.

If I'm wildly incorrect in any of these statements, feel free to correct me.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download