4

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? Commented Jun 18, 2014 at 7:52
  • Yes thats it, i run update50 as well, but no help: imgur.com/n055Trp
    – Tomas
    Commented Jun 18, 2014 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. Commented Jun 18, 2014 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
    Commented Jun 18, 2014 at 8:14

8 Answers 8

7

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
    Commented Jun 18, 2014 at 8:21
  • Don't worry, things like that happens from time to time even when you have a certain experience.
    – supeindesu
    Commented Jun 18, 2014 at 9:24
  • I am also having the same problem.I m in pset1 folder.I m using cs50 IDE.Thanks in advance Commented Oct 31, 2016 at 17:55
5

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

6
  • 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
    Commented Jun 28, 2015 at 13:46
  • @Arwa you should be in the same directory as the .c file before running make on it.
    – kzidane
    Commented Jun 28, 2015 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
    Commented Jun 28, 2015 at 14:03
  • also when I write cd dropbox, it says no such directory or file
    – Arwa
    Commented Jun 28, 2015 at 14:08
  • @Arwa what is the output of executing ls?
    – kzidane
    Commented Jun 28, 2015 at 14:09
5

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"

5

Try right clicking on folder name in explorer and choose integrated terminal and then execute ur commands...

3
  • Omg, thank you so much, I've been lost for so long, then your solution worked! Commented Jul 16, 2022 at 19:30
  • I selected the integrated terminal but now at the beginning in the terminal I am seeing the name of the terminal. It doesn't look very aesthetic. IS there a way to fix this? Commented Aug 23, 2022 at 23:50
  • Thanks it seems like this helped me too. I notice i would get this problem when i would delete my termainal to start fresh. I figured it had something to do with bash
    – mandov34
    Commented Apr 4 at 4:51
3

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.

2

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

2
  • omg you rescue my life bro, thanks a lot Commented Aug 20, 2021 at 3:45
  • I wrote the command "make hello" but it still shows the error "make: *** No rule to make target 'hello'. Stop.". Is there any way to fix it? Commented Feb 9, 2023 at 17:17
1

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

I had same issue and this was how i fixed it... I realized i wasn't running VS Code in the Harvard CS50 Codespace... So after going to code.cs50.io, on the webpage i clicked on the 'codespaces' link. So it didn't set up the CS50 environment for me... rather, on that page you should click on 'login' so that it connects you to the cs50bot invitation... then you can start all over and code hello.c, type the code and make hello...

You must log in to answer this question.

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