Welcome to your very first project of the semester! The goal of Project 0 is simple: ensure you’re fully set up with GitHub Classroom, familiarize yourself with the Makefile provided, and compile your very first C++ program. As basic as this sounds—just printing “Hello, World!”—it’s an essential milestone to confirm that your environment is ready for more complex tasks ahead. Please DO NOT SKIP ANY PARTS OF THIS PROJECT, COMPLETE THE ENTIRE THING YOURSELF if you want to make sure that you will be able to solve and debug the other projects by their deadlines.
By the end, you’ll have a firm grasp on the class workflow: from accepting an assignment in GitHub Classroom, to cloning your repository, to writing some code, to compiling via the terminal using make
. Simple, but crucial steps for your success in future projects!
This project is designed to get you comfortable with the infrastructure of our course. You’ll learn how to clone repositories, compile via a Makefile, and push your code back to GitHub. If you’re new to C++ or haven’t used the command line much, this will give you a great practice run.
[IMPORTANT] Do not skip this step. Otherwise, you’ll be ill-positioned to do this (or future) projects. You should not write and update your code directly on github, you must clone it onto your device first.
1) If you don’t already have one, go to GitHub and create a GitHub account. You will likely use your GitHub account professionally in the future, so choose a username you will want to keep.
2) Next, watch or review the following videos if you need a refresher on Git and GitHub:
3) Accept the Project 0 GitHub Classroom assignment via this link: Link
5) After accepting, clone the repository to your local machine. This will give you a local copy where you can edit files, compile your code, and eventually push your changes. Here’s a github guide!
[NOTE] You will also be provided with an in-depth guide on using GitHub Classroom and repositories in our course. If anything is still unclear after reviewing the guide, feel free to explore additional resources online or ask the TAs for help.
For ALL projects, including this one, part of your grade will be points for documentation. These are the requirements:
.hpp
, .cpp
, etc.) must have a comment at the top with:
1) In your cloned repository, create a file named HelloWorld.hpp
.
2) In your cloned repository, create a file named HelloWorld.cpp
.
3) In your cloned repository, create a file named test.cpp
.
4) Implement the following simple C++ program with separate files for a header (.hpp
), source (.cpp
), and test (.cpp
). The test will be for local testing purposes.
HelloWorld.hpp
// File: HelloWorld.hpp
// Author: Your Name
// Date: (today's date)
// A header file containing a function declaration for printing "Hello, World!"
#ifndef HELLO_WORLD_HPP
#define HELLO_WORLD_HPP
// Declaration of the HelloWorld function.
void HelloWorld();
#endif // HELLO_WORLD_HPP
HelloWorld.cpp
// File: HelloWorld.cpp
// Author: Your Name
// Date: (today's date)
// A source file that defines a function to print "Hello, World!"
#include "HelloWorld.hpp"
#include <iostream>
// Definition of the HelloWorld function.
void HelloWorld()
{
std::cout << "Hello World" << std::endl;
}
test.cpp
// File: test.cpp
// Author: Your Name
// Date: (today's date)
// A tes file thatt tests our function in HelloWorld.cpp
#include "HelloWorld.hpp"
int main() {
HelloWorld();
return 0;
}
5) Test your code locally by using make to compile.
6) Commit your code locally, then push it to GitHub.
Here is a guide to makefiles. This repository comes with a Makefile
that helps you compile your code more easily. Instead of using g++ in the terminal, you can simply type:
make
This command will look for a Makefile
in the current directory and compile the project using the rules specified within it. Other useful make commands include:
make clean # Removes .o files (object files) and clears out old build artifacts
make rebuild # Cleans, then re-runs make
Please note that the starter code makefile relies on a rule for make clean that isn’t there, you can fix this yourselves if you want by using the Makefile guide or online resources
[ENVIRONMENT NOTE] If you have any issues installing or using make
on your own machine (e.g., if you’re on Windows or macOS without Xcode command-line tools), we will provide you with a guide on how to SSH into the lab computers, where make
is already installed. Please refer to the video on the course homepage and request help in the tutoring lab if necessary. There are also many resources online that will help you with this task, including on stackoverflow.
By using the Makefile
, you ensure that your code is built consistently with the same settings our autograder uses. If you do not use the Makefile to verify compilation, then there is a high chance that your code will not compile when you attempt to submit on gradescope.
This is a trivial program, but testing is still important:
1) Compile with make
.
2) Run the resulting binary (which will be named test with the provided Makefile). For example:
./test
3) Confirm that “Hello, World!” prints to your terminal.
That’s it! You’ve successfully built and run your first program in our environment.
You will submit your solution to Gradescope via GitHub Classroom. The autograder will look for and compile your HelloWorld.hpp
and HelloWorld.cpp
.
Although Gradescope allows multiple submissions, it is not a platform for testing or debugging. You MUST test and debug your program locally.
For future projects, only 5 submissions per day are allowed. This project will be unlimited since it is an introduction.
Before submitting, be sure that:
Makefile
.“But it ran on my machine!” is not a valid argument for broken submissions. Here is an almost exhaustive list of compilation errors.
Once you have verified all the above, submit to Gradescope.
This project is due on 1/31.
No late submissions will be accepted.
Help is available via drop-in tutoring in Lab 1001B (see Blackboard for the schedule). Remember, the lab can get crowded as due dates approach, so coming early is your best strategy.
Authors: Michael Russo, Daniel Sooknanan, Georgina Woo, Prof. Maryash
Credit to Prof. Ligorio