From 182fc3e46e65191045567e6fcbfee8476e408889 Mon Sep 17 00:00:00 2001 From: Wu Yuanshou Date: Wed, 24 Apr 2019 11:42:29 +0800 Subject: [PATCH] fix example's mistake in slow-compiles.md the example lack the generation of factorial.o file which lead to an undefined reference error. --- docs/slow-compiles.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/slow-compiles.md b/docs/slow-compiles.md index 0853b661..366adf29 100644 --- a/docs/slow-compiles.md +++ b/docs/slow-compiles.md @@ -51,14 +51,15 @@ After compiling `tests-main.cpp` once, it is enough to link it with separately c ``` $ g++ tests-main.cpp -c -$ g++ tests-main.o tests-factorial.cpp -o tests && ./tests -r compact +$ g++ factorial.cpp -c +$ g++ tests-main.o factorial.o tests-factorial.cpp -o tests && ./tests -r compact Passed 1 test case with 4 assertions. ``` Now, the next time we change the file `tests-factorial.cpp` (say we add `REQUIRE( Factorial(0) == 1)`), it is enough to recompile the tests instead of recompiling main as well: ``` -$ g++ tests-main.o tests-factorial.cpp -o tests && ./tests -r compact +$ g++ tests-main.o factorial.o tests-factorial.cpp -o tests && ./tests -r compact tests-factorial.cpp:11: failed: Factorial(0) == 1 for: 0 == 1 Failed 1 test case, failed 1 assertion. ```