I'm trying to compile this assignment but I keep receiving this message I read that the file name should match the folder name but the file's name is cash.c and it is in a folder named cash under the pset1. This happened both in the Mario and hello assignments I fixed them by chance but it still happens. How can I fix it?

1 Answer 1


The overall rule is this: If you're trying to compile a file, let's call it myfile.c, then you need to be in the same directory as myfile.c and you need to issue the command make myfile, but not followed by a period or by .c.

You can check to see if the file is there with this command:

 ls -a

This is the simple rule. There are more complicated rules that you'll learn later, such as compiling programs with multiple source code files and a makefile file.

For this though, if you're not in the right directory and the source code file isn't in that directory, it will fail. Also, if you've written a .h file of the same name, it needs to be there too.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • Thank you! I used ''cd pset1 make cash'' and it worked it's compiling now although I'm not sure if that's how this error is solved. But now I'm getting a different error saying ''clang: error: linker command failed with exit code 1 (use -v to see invocation)''. If you know how I can solve this can you please help, help50 doesn't work for some reason. Thanks again :)
    – lalsez
    Aug 17, 2021 at 9:17

You must log in to answer this question.

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