Video Coming Soon...
WARNING: This exercise needs a full review to match recent changes to C. If you find problems please report them with the bug feature (top right, bug icon).
00: The Setup
In this exercise you'll install a C compiler and make a basic starter build you can use for simple stuff.
Windows
WARNING: Rough notes at the moment. I need to fire up hypervisor and test this since it's more complex on Windows.
For now, go to My lcthw-windows-installers project and follow the instructions there for installing C++. This will give you everything you need for C also.
Confirm your setup by running the following commands in Terminal:
make --version
git --version
gcc --version
cc --version
gdb --version
Linux
WARNING: Every brand of Linux is different, and there's no way I can support them all. I give instructions for Ubuntu/Debian style, and that's the main one I support. If you use something different then it's on you to figure it out. That's the price you pay for FREEDOM!
On Linux you'll want to install the developer tools for your brand of Linux. On Debian based systems (Ubuntu) you would do the following:
sudo apt update
sudo apt upgrade
# possibly reboot your computer
sudo apt install build-essential git gdb
This should be all you need. Once you've done that you should be able to do the following:
make --version
git --version
gcc --version
cc --version
gdb --version
If you can't run these commands then confirm you actually installed everything. You might need to do a reboot after the upgrade to confirm you received core updates like any Kernel or library updates.
MacOS
For MacOS you'll have to install XCode, and you'll need to run XCode one time to agree to the license. After that you should be able to do this in your Terminal:
make --version
git --version
clang --version
cc --version
lldb --version
If those don't work then see if it actually installed, and maybe you have to restart your computer? I haven't used a Mac in a while so please report back to me if these instructions aren't good.
Text Editors
I assume you have a text editor you like to use, so feel free to keep using it. If you're looking for a quieter programming experience that has less tools involved, then these editors may be worth a try:
NOTE: I'm working on a shoot-out of "programmers editors" that fit the vibe of "less is more." If you've got a favorite let me know.
Terminal
Every Operating System (OS) has a Terminal. The "Terminal" is simply a textual language interface to the computer. Anything you can do with your mouse you can do with the Terminal. Here's the list of terminals on each OS that I know of:
- MacOS: Terminal -- Find it in your Apps folder, double click it, then in your dock right-click and select "Keep in Dock."
- Windows: Terminal or Windows Terminal -- Hit the Win-Key, type "Terminal" to search for it and you can start it. It should be a black background window, not blue. If you get blue that's the old PowerShell terminal, which still works but I think Microsoft is phasing it out.
- Windows:
cmd.exe-- Do not use this. This is a hold-over from the MS-DOS days and sucks. There's still weirdos who insist it's better but they're also the same people who still use Windows 7. - Linux:
Terminal-- On Ubuntu this is now just called Terminal but it could be any number of possible terminals. It's up to you to find the one you like. There's so many.
Top #1 Terminal Tip
I'm assuming you know how to use your computer with the Terminal. If you don't then let me know and I'll try to add some Terminal basics material to the course.
If you're a mouse user then moving from the File Browser (like your Documents folder with icons) to Terminal is confusing. To make it easier, you can use the start command in Windows and the open command on MacOS and Linux.
The start/open commands basically mouse double-click a file you can see in the Terminal. If you need to see the current directory with your mouse, do this in Terminal on Windows:
start .
Or, do this in Terminal on MacOS and Linux:
open .
That opens it up as if you double clicked on that directory. You can then drag files into the terminal and it will paste their location. Try it out.
Additional Tools
These tools aren't necessary to complete the course, but can come in handy:
- A notebook. Sometimes writing things down manually helps you to remember them.
- Good headphones and music without words. I prefer in-ear headphones because over-ear headphones give me headaches after a few hours. The purpose of "music without words" is to avoid having audible talk while you're coding. I find that having someone speak in my ear while I'm trying to write, code, or paint is too confusing.
Project Folder
You should create a Project folder (directory, and I'll use both words all the time so remember this). You should be able to get to it easily with your Terminal. That means if you're putting it in G:\Things\Photos\2023\Documents\Backup\Projects then no, that won't work. Easiest way to make sure you can get to it on all platforms is do this:
- Start your Terminal fresh.
- Type
mkdir Projects - Type
cd Projects
That's it. Use start . or open . to see that. Make a folder for this course, and start keeping all of you programming projects there.
Daily Start
Your goal is to be able to start working as quickly as possible to break through the friction of getting started. Every day you start programming have a common ritual of getting started. Here's mine:
- Start Browser, Editor, Terminal.
- In Terminal:
cd Projects/whatever-im-working-on - In Editor:
cd Projects/whatever-im-working-on - Look at the thousands of tabs in my browser and say "I might need these still."
- Run a build. This usually tells me where I was last time I worked on it.
- Open a source file and start working on the next thing.
Find your start process and do it every day until it's second nature. You'll also need a way to start new projects but we'll work on that later.
Imposture Check
You should be able to open your terminal and editor of choice and open the project folder you've created for this course in less than 5 minutes. If not then spend some time making this faster. Getting to the start quickly is essential for overcoming the anxiety that comes from starting a new project.
Register for From Impostor to Programmer
Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.