# -*- mode: org -*-

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../../assets/css/2026.css" />
#+HTML_HEAD:  <link rel="icon" type="image/png" href="http://rachel.likespizza.com/web-assets/images/favicon-moose.png">


* 🛠️ Setup: Developer tools (Windows)

** Downloading the setup files
Download the zip file I made with required files here:

http://rachel.likespizza.com/courses/WINTOOLS.zip

Once downloaded, *Extract All* to any directory.

[[https://rachel.likespizza.com/courses/_images/reference/setup/files_extractall.png]]

(You can also right-click the file and go to "Extract All", or
something similar in older versions of Windows.)

-------------------------------------------------------------------------------

** Move the =mingw= folder

Keep your extracted zip folder open. Locate the =mingw= folder and
*copy* it.
(You can select the copy button in the file explorer bar, or
right-click the file and select the Copy icon.)

[[https://rachel.likespizza.com/courses/_images/reference/setup/copy_mingw_folder.png]]


Also open up *File Explorer* (from the Start menu) and go to *This PC*
then the *C:\* drive. *Paste* the folder here. (You can also right-click in an empty space and click the *Paste* icon.)

[[https://rachel.likespizza.com/courses/_images/reference/setup/paste_to_folder.png]]

-------------------------------------------------------------------------------

** Telling Windows where the MinGW files are.

This step will allow the programs we set up to be ran from anywhere
on the computer.

[[https://rachel.likespizza.com/courses/_images/reference/win-setup/win_envvar1.png]]

Click the Start Menu (the Windows icon on the bottom bar) and type
in "Path". Select the *"Edit the system environment variables"*
option.

[[https://rachel.likespizza.com/courses/_images/reference/win-setup/win_envvar2.png]]

From the *"System Properties"* window, click the
*"Environment Variables..."* button at the bottom.

[[https://rachel.likespizza.com/courses/_images/reference/win-setup/win_envvar3.png]]

In the *"Environment Variables"* window, under the bottom list
(*"System variables"*), locate the Variable named Path. Click it, then
select *"Edit..."*.

[[https://rachel.likespizza.com/courses/_images/reference/win-setup/mingw_envvar.png]]

In the *"Edit Environment Variables"* window, click *"New"* and type in
the following path: =C:\mingw\bin=

Click *"OK"* when done, and
click *"OK"* on the rest of these windows to close them.

(Note: If you installed to a different directory than the default
you will have to use that here.)

-------------------------------------------------------------------------------

** Installing Git desktop software

Git is used for source control, where we can track changes to code
over time, back it up to a server, and even collaborate with others.

In the unzipped WINTOOLS folder, run the *Git-2.52.0-64-bit.exe*
file.

Go through the steps, most of the defaults are fine, just look out
for the *Choosing the default editor used by Git* screen! Make sure
to select something other than vim:

[[https://rachel.likespizza.com/courses/_images/reference/win-setup/git_default_editor.png]]

-------------------------------------------------------------------------------

** Installing a code editor

[[https://rachel.likespizza.com/courses/_images/reference/setup/code_editors.png]]

To edit source code we need any *plaintext file editor*, though
something intended for code has more features that make working with
code easier.

I will probably be hopping between editors throughout the semester
just to show that you can work from anywhere. I've included
installers for three editors.

- *emacs:* This is my preferred editor but it has a bit of a
  learning curve, but I'll be happy to answer any questions about it.
- *geany:* A simple and lightweight code editor I like for small edits.
- *vscodium:* A version of VS Code with some Microsoft-related stuff
  ripped out of it. Has a bunch of features and can be customized,
  but we'll mostly just use it for code editing. I have this as an
  option because it's cross-platform on Win/Linux/Mac.

Feel free to install one or all of them to check out.

-------------------------------------------------------------------------------

** Verifying that everything was installed correctly
Follow these steps to verify that everything got installed!

[[https://rachel.likespizza.com/courses/_images/reference/setup/open_gitbash.png]]

Go to the start menu and type in "Bash". Open up *Git Bash.*

*** g++

[[https://rachel.likespizza.com/courses/_images/reference/setup/gitbash_gpp.png]]

In GitBash, type: =g++= , then hit ENTER.

- ✅ *Success:* It should give an error "g++: fatal error: no input
  files. compilation terminated."

  This is fine, because it means the g++ program works but it's
  complaining that we didn't tell it a C++ source file. But we're
  just testing to make sure g++ got set up properly.

- ❌ *Failure:* If it gives this error - "g++ : The term 'g++' is
  not recognized as the name of a cmdlet, function, script file, or
  operable program. Check the spelling of the name, or if a path was
  included, verify that the path is correct and try again."

  This means it can't find the g++ program. Make sure to review your
  *Environment Variables* step and make sure =C:\mingw\bin\= is
  added to the *PATH* variable.

*** make

[[https://rachel.likespizza.com/courses/_images/reference/setup/gitbash_make.png]]

In GitBash, type: =make= , then hit ENTER.

- ✅ *Success:* It should give an error "make: *** No targets
  specified and no makefile found. Stop."

  This shows that the make program works but it's just complaining
  that we don't have a project to make.

- ❌ *Failure:* If it gives this error - "make : The term 'make' is
  not recognized as the name of a cmdlet, function, script file, or
  operable program. Check the spelling of the name, or if a path was
  included, verify that the path is correct and try again."

  This means it can't find the make program. Make sure to review your
  *Environment Variables* step and make sure =C:\mingw\bin\= is
  added to the *PATH* variable.

*** gdb

[[https://rachel.likespizza.com/courses/_images/reference/setup/gitbash_gdb.png]]

In GitBash, type: =gdb= , then hit ENTER.

- ✅ *Success:* The gdb program will start and it may have a bunch
  of information; once you see a =(gdb)= prompt waiting for your
  input, type "exit" to leave.

- ❌ *Failure:* If it gives this error - "gdb : The term 'gdb' is
  not recognized as the name of a cmdlet, function, script file, or
  operable program. Check the spelling of the name, or if a path was
  included, verify that the path is correct and try again."

  This means it can't find the gdb program. Make sure to review your
  *Environment Variables* step and make sure =C:\mingw\bin\= is
  added to the *PATH* variable.

*** git

[[https://rachel.likespizza.com/courses/_images/reference/setup/gitbash_git.png]]

In GitBash, type: =git= , then hit ENTER.

- ✅ *Success:* A big list of git commands will be shown.

- ❌ *Failure:* There usually aren't any errors at this point, but
  if you find one let me know and I'll update these docs! :)

-------------------------------------------------------------------------------

** Creating, building, and running a test file

1. In GitBash, type: =notepad test.cpp= and hit ENTER.

   Notepad will launch and ask if you want to create a new file.
   Press "Yes".

2. Copy/paste the following code:
   #+BEGIN_SRC cpp
   #include <iostream>
   using namespace std;

   int main()
   {
       cout << "Hello!" << endl;
       return 0;
   }
   #+END_SRC

   [[https://rachel.likespizza.com/courses/_images/reference/setup/notepad_cpp.png]]

3. Save the file and close Notepad.

4. Back in GitBash, we're going to build the program with:

   =g++ test.cpp -o TestProgram.exe=

5. After hitting error if it doesn't show an error message then the
   build was successful. Run the program with:

   =./TestProgram.exe=

   It should show the "Hello!" message.

   [[https://rachel.likespizza.com/courses/_images/reference/setup/gitbash_testbuild.png]]

-------------------------------------------------------------------------------

That should be it! If you ran into any errors, please let me know so
we can get it ironed out!

-------------------------------------------------------------------------------
