Skip to content

Using--Libraries#23

Open
Butcher3Years wants to merge 24 commits intomainfrom
Using--Libraries
Open

Using--Libraries#23
Butcher3Years wants to merge 24 commits intomainfrom
Using--Libraries

Conversation

@Butcher3Years
Copy link
Copy Markdown
Owner

Using Libraries in C++ – Cherno-Style (Headers, Linking, Pain & Salvation) 🪓🔥

Branch: using-libraries
From The Cherno's C++ series — the episodes where he loses his mind over include paths, linker errors, static vs dynamic libs, and why build systems are both evil and necessary.

What "Using a Library" Actually Means

A library is just pre-written code you want to reuse (math functions, graphics, networking, JSON parsing, etc.).

To use one, you need to do three things:

  1. Tell the compiler where to find the headers (.h/.hpp files) → #include + include paths
  2. Tell the linker where to find the compiled code (.lib/.a or .dll/.so) → linking
  3. Make sure everything is compatible (C++ version, ABI, debug/release, 32/64-bit)

Cherno:

"90% of beginner frustration in C++ comes from libraries.
It's not the code — it's the build system screwing you."

Step-by-Step – How Cherno Teaches It

1. Header-only libraries (easiest – no linking!)

Examples: GLM (math), stb_image, dear imgui, nlohmann/json

// Just drop the .hpp file in your project
#include "glm/glm.hpp"          // or "nlohmann/json.hpp"

// Use it
glm::vec3 position(1.0f, 2.0f, 3.0f);

…] differs,and exploring types of strings based on sizes and their writting style
…lso for the performance of not creating other non wanted object

classes
and types of allocating class objects
and when to use them!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant