C++ solution to Advent of Code
English (United States) | 简体中文(中国大陆)
The source code is in the src/ directory.
Specifically, the solution to the problem of Year <yyyy> Day <d> is the function named Solve in the file src/year<yyyy>/day<d>/main.cc. For example, the solution to the problem of Year 2025 Day 1 is in src/year2025/day1/main.cc.
- Linux Operating System
- C++ compiler supporting fully C++23 (GCC 14, Clang 19 or higher versions)
Run:
$ ./autogen.sh
$ CXX=<compiler> ./configure
$ make -j$(nproc)where <compiler> is the compiler you want to use, such as g++-14 or clang++-19. Take g++-14 as an example: CXX=g++-14 ./configure.
$ ./build/bin/year<yyyy>/day<d> -p <part> -f <path>where <yyyy> is the year, <d> is the number of the day, <p> is the part number (1 by default), and <path> is the path to the input file. For example: ./build/bin/year2025/day1 -p 1 -f ./data/2025/day1/input.txt