C++ guides
Modern C++ guides: C++20 and C++23 features, compilers, build systems, and measured performance.
-
Fix 'No Matching Function for Call' in C++ — Reading GCC's Candidate List, Viable vs Not Viable, and Conversion Failures Error Reference
The error means overload resolution found candidates for the name but none of them was viable for the arguments given. This guide reads three real GCC...
-
Fix 'Passing const as this Argument Discards Qualifiers' in C++ — Const Objects, Const References, and Const Methods Error Reference
The error means a non-const member function was called on an object the compiler must treat as const. This guide reads three real GCC failures — a non-const...
-
Fix a Dangling std::string_view — Lifetime Rules for Views and References to Temporaries Error Reference
A std::string_view taken from a temporary std::string keeps the address and the length after the temporary is destroyed at the end of the statement: the...
-
Fix 'Cannot Bind Non-const Lvalue Reference to an Rvalue' in C++ — Temporaries, Function Arguments, and const& Error Reference
The error means a non-const lvalue reference was offered a temporary: a literal, an arithmetic result, or any other rvalue that has no lasting name to...
-
Fix 'Call of Overloaded Function Is Ambiguous' in C++ — Equally Good Conversions, and How Overload Ranking Breaks the Tie Error Reference
The error means overload resolution found two or more viable functions and none of them was better than all the others. This guide reads three real GCC...
-
Fix C++ "Use of Deleted Function" — Copying a unique_ptr Holder, Deleted Copies, and Deleted Overloads Error Reference
GCC stops the build with 'use of deleted function' when a copy, a call, or an overload lands on a function the program must not use. This guide...
-
Fix C++ shared_ptr Cycle Leak — Two Objects Keep Each Other Alive, weak_ptr Breaks the Cycle Error Reference
Two objects that hold std::shared_ptr to each other never get destroyed: each count stays at 1 after every outside pointer is gone, no destructor runs, and...
-
Fix C++ Deadlock with std::scoped_lock — Two Mutexes, Opposite Order, One Hang Error Reference
A program that locks two mutexes in opposite order in two threads can hang forever: each thread holds one mutex and waits for the other, and neither wait...
-
Fix CMake "Generator Does Not Match" and Stale-Cache Errors When Switching Ninja and Make Error Reference
Reconfiguring an existing build tree with a different generator fails with Error: generator : Unix Makefiles Does not match the generator used previously...
-
Fix CMake "Cannot Find Source File" and "No SOURCES Given to Target" Error Reference
Configure fails with two errors — Cannot find source file: src/main.cpp, and No SOURCES given to target: app — after a source file is renamed and...
-
Fix "Undefined Reference to Vtable" — the Missing Virtual Function Error Reference
A class with virtual functions compiles in every file and then fails to link with a single undefined reference to the vtable for the class, naming no...
-
Fix Template "Undefined Reference" — Why Template Definitions Cannot Hide in a .cpp Error Reference
A class template declared in a header and defined in a .cpp file compiles in both files and then fails to link with undefined references to every member the...
-
Fix "Multiple Definition" Link Errors — Header Definitions and inline Error Reference
A function and a variable defined in a header included by two source files fail to link with multiple definition errors for both. This guide reads the...
-
Fix "Cannot Find -l..." — How ld Searches for Libraries, and Where the Path Is Set Error Reference
The link fails with a single line — cannot find -lgreet — even though the library file is sitting in the project. This guide reproduces that error with a...
-
Cpp Std Min Element Not Member Fix Error Reference
layout: landing explore_theme: programming analytics_page: cpp_std_min_element_not_member_fix analytics_page_view_event...
-
Cpp Std Is Sorted Not Member Fix Error Reference
layout: landing explore_theme: programming analytics_page: cpp_std_is_sorted_not_member_fix analytics_page_view_event...
-
Cpp Std Includes Not Member Fix Error Reference
layout: landing explore_theme: programming analytics_page: cpp_std_includes_not_member_fix analytics_page_view_event...