#!/bin/bash set -e echo "=== Compile object files ===" g++ -std=c++17 -c vec.cpp -o vec.o g++ -std=c++17 -c mat.cpp -o mat.o echo "" echo "=== Create static library (archive) ===" ar rcs libmymath.a vec.o mat.o echo "Created libmymath.a" echo "" echo "=== Inspect archive contents ===" ar t libmymath.a echo "" echo "=== Symbols in the archive ===" nm -C -g libmymath.a echo "" echo "=== Compile and link main against the static library ===" g++ -std=c++17 -c main.cpp -o main.o g++ main.o -L. -lmymath -o app echo "Created app" echo "" echo "=== Check dynamic dependencies ===" ldd app || echo "(ldd not available or statically linked)" echo "" echo "=== Run ===" ./app