or.nomore
or.nomore

Reputation: 925

Eclipse can't run my Makefile

I'm writing a C project in Eclipse and while trying to run it I get the following error message:

(Cannot run program "make": Launching failed)

My Makefile is:

all : GenericHashTable.o TableErrorHandle.o
    gcc -Wall GenericHashTable.o TableErrorHandle.o -o all

GenericHashTable.o : GenericHashTable.c GenericHashTable.h TableErrorHandle.h
    gcc -Wall -c GenericHashTable.c -o GenericHashTable.o

TableErrorHandle.o :  TableErrorHandle.c  TableErrorHandle.h
    gcc -Wall -c TableErrorHandle.c -o TableErrorHandle.o

clean :
    rm all *.

Upvotes: 1

Views: 6126

Answers (3)

IanH
IanH

Reputation: 4058

Either use the internal builder as "Turbo J" already suggested or make shure 'make' is in your PATH.

You can set the PATH for the build process in the Project-Properties in 'C/C++ Build -> Environment' - click "Select..", choose PATH and then change it by adding the correct path for the 'make' command.

This way you can also set the PATH of your compiler - that may be necessary if you use the Internal Builder.

Upvotes: 0

Turbo J
Turbo J

Reputation: 7701

You can try the internal builder from eclipse:
Project->Properties->C/C++ Build

There (in the top level of C/C++ Build) you find Builder Settings->Builder Type which you set to Internal Builder. This way CDT does not require an external make command.

Upvotes: 1

locka
locka

Reputation: 6029

Is the formatting broken in your makefile or in your question? Commands on the line below the target & dependencies. Does this makefile work from the command line?

Assuming the makefile is correct check the obvious things such as ensuring Eclipse can see your toolchain. Perhaps it can't even find the make command or you haven't set it from preferences.

Also the CDT offers a managed makefile and a standard (manual) makefile. The managed means Eclipse will create the makefile for you. The standard makefile is a makefile you are responsible for writing. Perhaps if your project is simple you should use the managed makefile to save yourself the hassle of writing one.

Upvotes: 1

Related Questions