C++ linker presentation

This commit is contained in:
2026-02-24 10:21:15 +01:00
parent 0fda0d75fb
commit 6f3d98f388
32 changed files with 788 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
#!/bin/bash
echo "=== This build SHOULD fail with 'undefined reference' ==="
echo ""
g++ -std=c++17 main.cpp -o app 2>&1 || true
echo ""
echo "The linker cannot find a definition for add(int, int)."
echo "Fix: provide the .cpp that defines it, or link the correct library."

View File

@@ -0,0 +1,8 @@
#include <iostream>
int add(int, int); // declared but never defined
int main() {
std::cout << add(3, 4) << "\n";
return 0;
}