0

enter image description here

i just started CS50 and i am in week 1 however when i type in CS50 IDE and save file as hello.c, it never gets compiled.i used update50 command to make sure i am updated and checked the directory but i also have the same error
why is this error happening ??

4 Answers 4

3

This will happen if you accidentally saved the file name as "hello.c " (with a space following the c).

First, the icon for hello.c in the file tree shows as a text file. It should show as a C file like this:

enter image description here

Second, there is no C syntax highlighting in the hello.c window.

Suggest you File > Save As hello.c (be careful to type it exactly). You should then see two "hello.c" files in the file tree.

enter image description here

Right-click -> delete the hello.c that shows with the text icon. It will ask a confirmation message, and close the open editor pane. Double click on hello.c (with the C icon). It will open in the editor window, and now you should be able to compile.

1
  • Thanks it worked :) :) Mar 22, 2017 at 14:47
0

enter image description here

I've definitely written it correctly but I'm having issues as well. Could you help out here?

4
  • same problem Im having
    – vedansh
    Jul 30, 2020 at 23:31
  • did anyone figure this one out? i'm stuck:( Aug 24, 2020 at 2:27
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Oct 6, 2021 at 15:46
  • Someone looking for solution still, As you can see hell/ is not a C file but Folder and you cannot clang folder so you need to first "cd hello" to go inside that directory and also in visual studio this problem occurs because it makes 2 folders of same name for ex: ~project/hello won't have your C files but ~project/hello cd hello will make you enter "~project/hello/hello" the folder which contains the C files, So it's actually two folders of same name which visual studio don't show, and i found out it by going in directory and open folders. Thanks and sorry for bad English
    – Mad Wolf
    Jun 4 at 6:55
0

I'm having the same problem, but the file is saved correctly. I'm still getting "no such files or directory". Any help?

2
0

i created a new terminal enter image description here

before that it was like this enter image description here

1
  • While you got it to work by creating a new terminal tab, the problem in your case is different. You have your files in a different directory (your home directory, notated with ~) and not in the hello folder, which is where you were looking. The new terminal places you in your home directory, but it is important to know that the issue is with where the file is and where you are looking. This is a different issue than the question, which had the wrong file type due to an extra space being placed in the file name. Jul 21, 2021 at 22:53

You must log in to answer this question.

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