Skip to main content

🛠️ Lesson 1.3: Setting Up the C++ Toolchain

A C++ Unreal project needs a compiler and an IDE wired to the engine. Get this right once and every later lesson "just builds." Get it wrong and you'll fight phantom errors for hours — so we'll be precise.

🎯 Learning Objectives

By the end of this lesson, you will be able to:

  • Install the correct compiler toolchain for your platform
  • Select the Unreal Engine components required for C++ development
  • Choose and configure an IDE — Visual Studio 2022 or JetBrains Rider
  • Generate project files and confirm a clean first build
  • Add a correct .gitignore so only source and content are tracked

Estimated Time: 60 minutes

Engine Version: Unreal Engine 5.8

In This Lesson

The Pieces You Need

C++ development in Unreal involves four cooperating pieces. When a build fails mysteriously, it's almost always one of these being missing or mismatched:

graph LR A["Compiler toolchain
(MSVC / Clang / Xcode)"] --> D["Unreal Build Tool (UBT)"] B["Unreal Engine 5.8
+ source/symbols"] --> D C["Your IDE
(VS 2022 / Rider)"] --> D D --> E["Compiled module → editor loads it"]
Figure 1: Unreal Build Tool (UBT) orchestrates the compiler using your project's .Build.cs rules. The IDE is a front-end; UBT does the real work.

📖 Key term: UBT

Unreal Build Tool (UBT) is Unreal's own build orchestrator. It reads your .Build.cs and .Target.cs files, figures out dependencies, and drives the platform compiler. You rarely call it directly — the editor and IDE do — but knowing it exists explains why Unreal builds differ from plain C++ projects.

Windows: Visual Studio 2022

Windows is the most common Unreal C++ platform. The compiler comes with Visual Studio, so installing VS correctly covers both compiler and IDE.

Install the right workloads

In the Visual Studio Installer, select these workloads and components:

  • Game development with C++ (this workload includes the Unreal-oriented components)
  • Desktop development with C++
  • Under individual components: MSVC v143 build tools, the Windows 10/11 SDK, and C++ profiling tools
  • Unreal Engine installer component (adds UE integration and IntelliSense support)

✅ Pro Tip

Epic publishes an official "Setting Up Visual Studio for Unreal Engine" guide that lists the exact components per engine version. When in doubt, follow that page — component names shift slightly between VS updates.

Engine components

In the Epic Games Launcher, next to Unreal Engine 5.8, use Options to ensure these are installed:

  • Engine Source — lets you step into engine code while debugging (invaluable)
  • Editor symbols for debugging — readable call stacks when things crash

⚠️ Watch Out

Editor symbols are large (many GB) but worth it. Without them, a crash gives you a stack of hex addresses instead of function names. Install them before your first real debugging session.

macOS & Linux

The concepts are identical; only the compiler differs.

  • macOS: install Xcode from the App Store (provides the Clang toolchain and a debugger). JetBrains Rider is the most popular IDE for day-to-day Unreal C++ on Mac; Xcode itself can build and debug.
  • Linux: Unreal ships a bundled Clang toolchain. Rider and Visual Studio Code are the common editors. You typically build the engine from source or use Epic's Linux binaries.
💡 Cross-platform note: This course's code is platform-neutral Unreal C++ — the same .h/.cpp compiles everywhere. Only the setup in this lesson is platform-specific; everything after is not.

Visual Studio vs Rider

Both are excellent. Here's an honest comparison so you can choose deliberately:

AspectVisual Studio 2022JetBrains Rider
CostFree (Community edition)Paid (free for some cases)
Unreal awarenessGood, esp. with UnrealVS & the UE componentExcellent — built-in Unreal support, understands reflection macros
IntelliSense / code insightSolid; can be slow on huge projectsFast, accurate; strong refactoring
Blueprint awarenessLimitedCan show Blueprint usages of C++
PlatformWindowsWindows, macOS, Linux

✅ Recommendation

If you're on Windows and just starting, Visual Studio 2022 Community is free and fully capable — use it. If you already own a JetBrains license or want the best Unreal-specific tooling, Rider is a joy. Either works for this entire course.

Generating Project Files

Here's a subtlety that confuses newcomers: the .sln / IDE project files are generated, not authored. They're derived from your .uproject and Source/ tree. If you add a class outside the editor, or pull new code, you regenerate them.

To generate or regenerate them, right-click the .uproject file:

Right-click MyProject.uproject  →  "Generate Visual Studio project files"

Or from the command line (useful in scripts / CI):

# Windows — invoke UnrealBuildTool via the engine's batch file
"C:\Program Files\Epic Games\UE_5.8\Engine\Build\BatchFiles\Build.bat" ^
    -projectfiles -project="C:\Path\To\MyProject.uproject" -game -engine

⚠️ The #1 newcomer fix

If your IDE shows red squiggles everywhere, classes "don't exist," or a build behaves oddly after you added files: regenerate project files, then rebuild. It resolves a large fraction of "it was working yesterday" problems. Deleting Intermediate/ and Binaries/ first makes it a clean regeneration.

The very first build after project creation may take several minutes — Unreal compiles your module and links against the engine. Subsequent incremental builds (and Live Coding, in the next lesson) are far faster.

A Correct .gitignore

From Lesson 1.2 you know which folders are generated. Put that knowledge into a .gitignore at your project root so your repository stays lean and conflict-free:

# Unreal generated folders — never commit
Binaries/
Build/
DerivedDataCache/
Intermediate/
Saved/

# IDE / project files (generated from .uproject)
.vs/
.idea/
*.sln
*.suo
*.xcodeproj
*.xcworkspace

# OS noise
.DS_Store
Thumbs.db

# Keep: Source/, Content/, Config/, Plugins/, and the .uproject itself

📖 What you DO commit

Source/ (your code), Content/ (your assets), Config/ (your settings), Plugins/ (project plugins), and the .uproject. Everything a teammate needs to regenerate and build — nothing that a build produces.

✅ Pro Tip

Because Content/ holds large binary .uasset files, many teams add Git LFS for those. It's optional for solo learning but standard on real projects. We'll note it again when it matters.

Hands-on Exercise & Quiz

🏋️ Exercise: Verify your toolchain

Objective: Confirm the setup end to end before writing real code.

  1. Create a new project from a C++ template (e.g. "Third Person", with C++ selected — not Blueprint).
  2. Let the initial build complete and the editor open.
  3. Close the editor, delete Intermediate/ and Binaries/, regenerate project files, and rebuild from the IDE. It should succeed.
  4. Add the .gitignore above, run git init, and confirm git status lists Source/, Content/, Config/, and the .uproject — but not Binaries/ or Intermediate/.
💡 Hint

If step 3 fails to build, the usual culprits are a missing Windows SDK, the wrong MSVC version, or not having regenerated project files after deleting Intermediate/. Re-check the workloads in the Windows section.

✅ Success looks like

A clean rebuild from a deleted Intermediate/, the editor reopening, and a git status that shows only source/content/config/uproject as untracked. If all three hold, your toolchain is solid for the rest of the course.

🎯 Quick Quiz

Question 1: What actually drives the compiler in an Unreal build?

Question 2: Your IDE suddenly shows errors for classes that clearly exist. Best first fix?

Question 3: Which folder should be committed to source control?

Summary

🎉 Key Takeaways

  • C++ Unreal development needs four cooperating pieces: compiler, engine (with source + symbols), IDE, and UBT.
  • On Windows, install Visual Studio 2022 with the Game development with C++ workload; on macOS use Xcode; on Linux use the bundled Clang.
  • Visual Studio 2022 Community (free) or Rider (paid, excellent Unreal support) both work for the whole course.
  • IDE/solution files are generated — regenerating them is the fix for most phantom errors.
  • Commit Source/, Content/, Config/, Plugins/, and the .uproject; ignore all generated folders.

📚 Additional Resources

🚀 What's Next?

Toolchain ready. Before we create a class, a focused refresher on the specific C++ language features Unreal leans on hardest — references, pointers, const, and a little template magic — so nothing in later code feels like a surprise.

🎉 Lesson complete!

Your machine can build Unreal C++. Let's sharpen the language.