0

enter image description hereI'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

enter image description here

2
  • This means that you linked to something that clang can't find. Can you post your code so that we can find the error? It is most-likely a function prototype or #include that is causing the issue. Aug 17, 2021 at 10:38
  • I posted it, sorry I don't know how to put the exact code so I just put the screenshot.
    – lalsez
    Aug 17, 2021 at 11:24

1 Answer 1

0

It is just simply because you are not in the right folder. More specifically you can see the error here : printscreen_terminal_error

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/

5
  • 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 :)
    – lalsez
    Aug 18, 2021 at 7:34
  • @lalsez cd /cash will send you to a folder that doesn't exist (a directory named cash 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, or cd cash, if you are already in the pset1 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)''.
    – lalsez
    Aug 19, 2021 at 9:35
  • 1
    You 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 either cd ~/pset1/cash or cd 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 or cash, respectively--these are not the full command). Aug 19, 2021 at 10:40

You must log in to answer this question.

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