#C++ Gigasecond - cmake error

13 messages · Page 1 of 1 (latest)

primal karma
#

I'm following my standard approach:

exercism download --exercise=gigasecond --track=cpp
cd gigasecond
mkdir build
cd build
cmake -G "UNIX Makefiles" ..

but on this exercise I'm getting the following output:

-- The CXX compiler identification is GNU 12.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: Boost_INCLUDE_DIR date_time) (Required is at
  least version "1.58")
Call Stack (most recent call first):
  /usr/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.26/Modules/FindBoost.cmake:2377 (find_package_handle_standard_args)
  CMakeLists.txt:13 (find_package)

I don't think anything's changed since I last ran cmake (yesterday afternoon). Any advice on how to fix?

#

I assume it's complaining because I don't have the boost libraries installed - but I really don't want them on this system 🙂

formal parcel
#

You guessed correctly. You can do the exercise on the website if you want to skip installing Boost

#

You could also remove the boost requirement from the CMakeLists.txt and do it without boost. It is a lot easier with it though.

stiff nimbus
#

why does this need boost?

formal parcel
#

The test expects boost::posix_time::ptime

#

as a return type from the advance function. The solution reduces to a single line with boost:

#

Spoilers ahead:

#

||boost::posix_time::ptime advance(boost::posix_time::ptime start){return start + boost::posix_time::seconds(1'000'000'000);}||

primal karma
#

yeah, it was trivial with boost.

primal karma
#

(which sort of makes me wonder what the purpose of this exercise was.)

formal parcel
#

To explore Boost, and to appreciate it would be my guess

delicate viper
#

If the C++ track is ever updated to support C++20, we could perhaps update this exercise to use the new tools in std::chrono. Haven't really looked at all of them yet; food for thought 😄