0

I have exercise 1 of pset1 ready to go. However, I seem unable to compile the program. I follow the below steps (in fact, I deleted everything and created it from scratch):

  1. Create New Folder, name it pset1
  2. Create New File, name it water.c
  3. enter command cd workspace/pset1

-> I receive the following error: bash: cd: workspace/pset1: No such file or directory

See below print screen.

Print Screen, see error message in terminal

I see that some people here had similar issues to the one I am facing with the cs50.io. However, some of the answers suggested something relating to dropbox. The 2016 course seems not to suggest using dropbox. If I am not mistaken in this assertion, I would like to keep it this way and not use dropbox, given that I already seem to be struggling with basic instructions, and wouldn't want to make things more complicated.

Any help is appreciated. And never mind, the program I wrote, I would like to work on that. It probably contains a good few errors to tinker with :)

All the best, Claire

1

It looks as though you don't have a full understanding of how directory structure works. Looking at the image that you posted, you have already created the subdirectory pset1 in the directory ~/workspace. If you look at the command line prompt, it says clairefasstner:~/workspace/pset1. That prompt gives the username before the colon and everything after the colon is the current path to where you are in the file directory. The ~ is a shorthand representation of the user's home directory and /workspace/pset1 is the path through the subdirectories below the home directory.

With that in mind, think about the command that you are trying to execute, cd workspace/pset1 Since there's no leading /, that command means to change to the path relative to the current location. In other words, switch to /workspace/pset1/workspace and then to /workspace/pset1/workspace/pset1. Since there is no subdirectory workspace under /workspace/pset1/, the system gives the error that it doesn't exist. In short, you're already in the directory that you're trying to get to.

The cd or change directory command will move from the current location to the target location, if it exists. The target can be absolute (the fully qualified path name) or relative (a subdirectory or parent) to the current directory. For instance, cd .. will move up one directory to the parent. cd ../.. would move up two directories, and cd ../pset2 would move sideways one directory to pset2, if it exists.

Looking at the tree structure on the side of the image, the water.c file looks like it exists in the current directory. You can verify that by running the ls command. if you enter make water in the current directory, it should build the executable.

You should review any course material on directory structure as well as doing a little internet research to find some extra tutorials on directory structure and commands in Linux. It would help a great deal.

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

| improve this answer | |
0

you just write cd ~/workspace/pset1/ rather than cd workspace/pset1. you need to add / after pset1 to move into the pset folder indeed.

| improve this answer | |

You must log in to answer this question.

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