2

I have created very first C program hello world. Its exact copy of the program from 1 week, lecture continued. When I try to make hello in terminal, I got this

error message: make: *** No rule to make target `hello'.  Stop.

How to solve it please?

4
  • Are you using the cs50 appliance? Jun 18 '14 at 7:52
  • Yes thats it, i run update50 as well, but no help: imgur.com/n055Trp
    – Tomas
    Jun 18 '14 at 8:07
  • Good deal, use 'ls' to make sure that you see your hello.c file in the same directory that you're running make from. Jun 18 '14 at 8:08
  • I am not linux user:) tried ls, I see folders etc. But didn't find in gedit where to make a path to dropbox folder or so.
    – Tomas
    Jun 18 '14 at 8:14
3

Take a look at the terminal window, are you inside Dropbox/pset1?

3
  • Thank you, now I got it, I just had to move to proper folder before running make:) Thanks a lot, have spend nearly 1 hour on this:(
    – Tomas
    Jun 18 '14 at 8:21
  • Don't worry, things like that happens from time to time even when you have a certain experience.
    – supeindesu
    Jun 18 '14 at 9:24
  • I am also having the same problem.I m in pset1 folder.I m using cs50 IDE.Thanks in advance Oct 31 '16 at 17:55
2

You should first navigate to the directory where hello.c exists then just run make hello!

5
  • I ran previous programs successfully while remaining in jharvard@appliance(~) but now when write make hello-1, it says no rule to make target 'hello-1'.stop.
    – Arwa
    Jun 28 '15 at 13:46
  • @Arwa you should be in the same directory as the .c file before running make on it.
    – kzidane
    Jun 28 '15 at 13:59
  • I have two programs in same folder.when I make first one, it is compiled successfully but for second one it says no rule to make target 'hello-1'.stop. If it was directory issue then it should not compile first program as well
    – Arwa
    Jun 28 '15 at 14:03
  • also when I write cd dropbox, it says no such directory or file
    – Arwa
    Jun 28 '15 at 14:08
  • @Arwa what is the output of executing ls?
    – kzidane
    Jun 28 '15 at 14:09
2

the command/file name combination is case sensitive - make sure you have named your file "hello" rather than "Hello". If it's capitalised, try "make Hello"

1

If any of these solutions above have not solved your problems, here's another solution:

the word after command "make" should be the same as the file name. example: File name:hello.c Command should be written: make hello

1
  • omg you rescue my life bro, thanks a lot Aug 20 at 3:45
0

This was great to find, also had to adjust so that directory read: jharvard@appliance (~/Dropbox/pset1): instead of jharvard@appliance (~): by "cd" in latter

0

Other way which helped me is typing: cd (you will moved into default directory). Then type ls and hope you'll see your file there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .