Skip to content

Instantly share code, notes, and snippets.

@dbechrd
Last active January 3, 2023 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbechrd/10f142d2ce5dff60b7e34d8e61af0344 to your computer and use it in GitHub Desktop.
Save dbechrd/10f142d2ce5dff60b7e34d8e61af0344 to your computer and use it in GitHub Desktop.
Shortened script for this video: https://www.youtube.com/watch?v=of7hJJ1Z7Ho
Create a new project
Empty project
Project name: Square
I like to put all of my source code in a "Development" folder
Leave Solution name blank
Ensure the "Place solution and project in the same directory" box is checked
I usually just delete the default filters. They cause confusion because they're not one-to-one with the actual files on disk.
Instead, let's click "Show All Files" icon to work with the actual directory structure
In your project folder, create a "src", "include", "lib" and "bin" directory.
Right-click the src directory, Add -> New Item...
Call it "main.cpp"
```cpp
#include <cstdio>
#define UNUSED(x) ((void)(x))
int main(int argc, char *argv[]) {
printf("Hello youtube\n");
UNUSED(getchar());
return 0;
}
```
Open Project Settings and make the following changes:
Output directory:
$(SolutionDir)bin\
Intermediate directory:
$(SolutionDir)obj\
*NOTE* they MUST end with a slash!
Debugging -> Working Directory:
$(ProjectDir)bin/
C/C++ -> Additional Include Directories:
include
Linker -> Additional Library Directories:
lib
extra credit options:
Project properties -> C/C++ -> Preprocessor
Down arrow -> Edit... paste "_CRT_SECURE_NO_WARNINGS" before "<different options>" (can also just add and type semi-colon manually)
C/C++ -> General -> Warning Level
C/C++ -> All Options -> C++ Language Standard
Tools -> Options -> Debugging -> General -> Automatically close the console when debugging stops
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment