Homework - Getting Started

Goals

Notes

Steps

  1. Start a browser.

    Type the following URL in the browser's location text area. Replace YOUR_USERNAME in the URL with your loki username.

    classes.cs.kent.edu/svn/cs23021/001/YOUR_USERNAME/cs23021
    

    You will be asked for a username and password.

    No files or directories will be present in the page that comes up.

  2. Log in to loki using ssh.

    Enter the following commands:

    -> ls        # List your files
    -> ll        # List your files, with more information
    -> pwd       # Print working directory, the directory you're currently in
    
  3. Check out your working copy. Fill in YOUR_USERNAME with your loki username in the following command.
    -> svn co http://classes.cs.kent.edu/svn/cs23021/001/YOUR_USERNAME/cs23021
    
  4. List your files again. Note the cs23021 directory is now present, this is the working copy.
    -> ll        # List your files
    
  5. Change directory into the working copy.
    -> cd cs23021       # Change directory
    -> pwd              # Print working directory
    
  6. Create a directory in the working copy named Hello. Add Hello to the files and directories that are being versioned.
    -> mkdir Hello          # Unix mkdir command
    -> svn add Hello        # svn command
    

    Or instead do it all at once (don't do this if you've done the previous two).

    -> svn mkdir Hello      # svn mkdir command, creates and adds to versioning
    
  7. Commit.
    -> svn commit -m "created directory for hello world program"
    

    Verify the directory has been created using the browser.

  8. Change directory into the Hello directory.
    -> cd Hello          # Change directory
    -> pwd               # Print working directory
    
  9. Under the Window menu get a second terminal window. Use one window for editing, use the other window for commands. I recommend not maximizing your windows.

    Start vi or emacs using hello.cpp

    -> emacs hello.cpp      # Use one of the other
    -> vi hello.cpp         # Use one of the other
    

    Type in the following header comment. Replace YOUR NAME with your name.

    /*Greet the world.
     *
     *Author: YOUR NAME
     */
    

    Make sure you do a write/save.

  10. Add hello.cpp to the files that are being versioned.
    -> svn add hello.cpp     # Adding a file is only done once
    
  11. Commit. Verify using the browser.
    -> svn commit -m "added header comment"
    

    Every complete C++ program must have a function named main so if you compile the file at this point there will be error messages about the lack of the main function.

  12. Compile hello.cpp if you want. Notice the error messages.
    -> g++ hello.cpp      # Compile
    
  13. int main()
    {
    
    }
    
  14. Commit, verify in the browser.
    -> svn commit -m "added main function to hello.cpp"
    
  15. Compile hello.cpp Fix any compiler errors. When there are no more compile errors commit the file again.
    -> g++ hello.cpp
    
  16. Add statements in body of main. Replace YOUR NAME with your name.
        // Output greeting.
      std::cout << "Hello World!\n";
      std::cout << "My name is YOUR NAME!\n";
      
      return 0;
    
  17. Commit, verify in the browser.
    -> svn commit -m "added output in main"
    
  18. Compile hello.cpp and run. Fix any compiler errors. When there are no more compile errors commit the file again.
    -> g++ hello.cpp
    -> ./a.out          # Run your program
    
  19. Keep working until the program is correct. Make sure you do a final commit.

Final Note

It is important to master the skills used above.

If you have any trouble with any of the above ask your instructor.

Upon completion of this assignment it will be assumed you are comfortable with the skills used in the steps above.