PDA

View Full Version : Makefile issues


roguers79
November 30th, 2005, 06:58 PM
Hey,
I am having problems with my make files. I type in :$make helloworld. Yet I still get an error "helloworld command not found". I have no problems with makefiles from programs I have downloaded. My make file is as follows:
helloworld: helloworld.c
gcc -o helloworld helloworld.c
Thanks in advance guys.

Houman
November 30th, 2005, 11:09 PM
hello roguers79;

If you remove the dollar sign ($) and then type your command again i think it will work;
i think youre copying this from a tutorial and when they tell you to do:

$somecommand


you shouldnt actually type the dollar sign, its just there to tell you you should type it at a terminal;

good luck;
(and it really wouldnt make sense to have a makefile for a one file project, but im assuming youre just experimenting :razz: )

roguers79
November 30th, 2005, 11:46 PM
I have done it with out the $ sign. I was doing this during class tonight and my professor was as confused as I. I would like to point out this worked before i upgraded from hoary hedghog to breezy.

darth_vector
December 1st, 2005, 01:49 AM
some versions of make are very pedantic about the tab. do you have:

helloworld: helloworld.c
<tab>gcc -o helloworld helloworld.c

in your makefile?

thumper
December 1st, 2005, 07:28 AM
As an aside, the default target with make is the first one it finds, so in your case just typeing makeshould build helloworld.

If you are still having problems, post the contents (I am assuming that they are small).

roguers79
December 1st, 2005, 04:26 PM
My make file does have the tab there.

darth_vector
December 1st, 2005, 07:12 PM
are you using soft-tabs by any chance? these arent real tabs, they are spaces...

Houman
December 1st, 2005, 08:34 PM
i dont think the tab is the problem, make usually gives a specific error when the tab is missing such as "missing seperator" or something of the sort;

i would suggest you ensure the name of your makefile is Makefile and then just type make at the terminal; (so dont do make helloeworld, just make)

also what happens if you just do :
gcc -o helloworld helloworld.c
at the terminal? (instead of using the makefile)?

regards

toojays
December 2nd, 2005, 03:38 AM
My guess is that when you run helloworld, you need to run it as ./helloworld for bash to find it. Try that.

Houman
December 2nd, 2005, 12:53 PM
Dear toojays;

he is not running the executable at any point, so that advice is kind of irrelevant;
he just gets an error when he tries to run make;

but yea if he was to run the executable you are right in that he would have to type ./helloworld;

regards;
Houman