I'm getting this error when I try to compile pset1 cash assignment, can someone please help? help50 also doesn't work so I really don't know what the problem is. enter image description here
1 Answer
It is just simply because you are not in the right folder. More specifically you can see the error here :
clang (which is similar to make) tries to compile the cash folder instead of the cash.c program
Type in your terminal : cd \cash
in order to Change Directory (cd) and go in the right folder
Reexecute command line and "voila", job is done !
NB : Don't miss Doug's video about command line tools https://cs50.harvard.edu/x/2021/shorts/command_line/
-
There are two
cash.c
files in their system. One in the~/pset1
directory and one in~/pset1/cash
(remember to use forward slashes/
and not back slashes\
in Linux). From the highlighted file in the GUI, it looks as though they have loaded the file in the~/pset1
directory, so they will need to move that to the cash folder beforehand. But, yes, the issue is that there already exists~/pset1/cash
as directory where clang is trying to make a file of the same name. Aug 17, 2021 at 17:31 -
Thank you for the video I'm watching it right now. However, I typed ''cd \cash'' and now it says ''bash: cd: cash: No such file or directory''. I deleted the file cash.c which was in the cash folder and I put the cash.c file which was in the pset1 directory but it still doesn't work. I had this problem both in Mario and hello assignments so I think there is a general problem wrong with the directory and files if you know what else I can do that would be great, thanks :)– lalsezAug 18, 2021 at 7:34
-
@lalsez
cd /cash
will send you to a folder that doesn't exist (a directory namedcash
within your root fomder). You will need to either use the directory paths from my comment~/pset1/cash
, which will work no matter the directory you are currently in, orcd cash
, if you are already in thepset1
directory. Aug 18, 2021 at 11:29 -
I tried ~/pset1/cash and cd cash now and it still doesn't work. When I type ~/pset1/cash it says ''bash: /home/ubuntu/pset1/cash: Is a directory''. The only way this code compiles is when I type cd pset1 but then I get the error ''clang: error: linker command failed with exit code 1 (use -v to see invocation)''.– lalsezAug 19, 2021 at 9:35
-
1You will still need to type
cd
before any directory path. I was giving the correct path options for you to use instead of/cash
. The full commands from my previous comment would be eithercd ~/pset1/cash
orcd cash
, following the conditions/caveats I oreviously mentioned. The anatomy of what you are doing is the change directory command (cd
) followed by the path to a directory you want to go to. The path you provide can be either the exact path through the hierarchy or relevant to where you currently are (~/pset1/cash
orcash
, respectively--these are not the full command). Aug 19, 2021 at 10:40
#include
that is causing the issue.