I’m on Ubuntu 22.04 using WSL2 in Windows 11. I have catch2
version 2.13.8 installed locally. I’m building the parallel-letter-frequency exercise with this Bash script:
#!/bin/bash
if [ ! -d build ]
then
mkdir build
cd build
cmake -D EXERCISM_TEST_SUITE=1 -DEXERCISM_INCLUDE_BENCHMARK=1 -G "Unix Makefiles" ..
cd -
fi
if [ -d test ]
then
rm -rf test
fi
make -C build
I’ve used the above script (excluding the -DEXERCISM_INCLUDE_BENCHMARK=1
argument) in all other exercises without issue.
I’m getting these linker errors:
/usr/bin/ld: CMakeFiles/parallel-letter-frequency.dir/parallel_letter_frequency_test.cpp.o: in function `Catch::Benchmark::OutlierClassification Catch::Benchmark::Detail::classify_outliers<__gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > > >(__gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >)':
parallel_letter_frequency_test.cpp:(.text._ZN5Catch9Benchmark6Detail17classify_outliersIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEENS0_21OutlierClassificationET_SB_[_ZN5Catch9Benchmark6Detail17classify_outliersIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEENS0_21OutlierClassificationET_SB_]+0x6f): undefined reference to `Catch::Benchmark::Detail::weighted_average_quantile(int, int, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >)'
/usr/bin/ld: parallel_letter_frequency_test.cpp:(.text._ZN5Catch9Benchmark6Detail17classify_outliersIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEENS0_21OutlierClassificationET_SB_[_ZN5Catch9Benchmark6Detail17classify_outliersIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEENS0_21OutlierClassificationET_SB_]+0x8a): undefined reference to `Catch::Benchmark::Detail::weighted_average_quantile(int, int, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >)'
/usr/bin/ld: CMakeFiles/parallel-letter-frequency.dir/parallel_letter_frequency_test.cpp.o: in function `void Catch::Benchmark::Benchmark::run<std::chrono::_V2::steady_clock>()':
parallel_letter_frequency_test.cpp:(.text._ZN5Catch9Benchmark9Benchmark3runINSt6chrono3_V212steady_clockEEEvv[_ZN5Catch9Benchmark9Benchmark3runINSt6chrono3_V212steady_clockEEEvv]+0x354): undefined reference to `Catch::Benchmark::Detail::analyse_samples(double, int, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/parallel-letter-frequency.dir/build.make:115: parallel-letter-frequency] Error 1
What am I doing wrong?