views:

144

answers:

3

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 *.
+1  A: 

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.

locka
i tried to open a new project with project type: Makefile, and with the minGW gcc toolchain, but it still give me this error.and about the standard makefile, i have to write it because it is part of my project.any more ideas?
or.nomore
well, i just notice that before the error it writes to me:**** Build of configuration Default for project newEx4 ****and i can see a Default library with makefile diffrent from mine.is it possible that it use the default and not mine?how can i fix this?
or.nomore
Well, this isn't the answer i search for, but eventually i did use the standard makefile and it's working OK
or.nomore
+1  A: 

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.

Turbo J
A: 

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.

IanH