Skip to main content

Local development

To run the code for your challenge locally, you’ll need vcpkg & make installed. You’ll also need the VCPKG_ROOT environment variable set to the path where vcpkg is installed. The script for your challenge (like ./your_sqlite3.sh) will automatically compile your code using the rules defined in CMakeLists.txt before executing it. It’ll look something like this:

File structure

  • The files for your solution are placed in the src/ directory.
  • src/Main.cpp contains the main function, which is what the test runner executes.
  • CMakeLists.txt contains the rules for compiling your program.

Adding more files

You can add more files and directories to src/. The test runner will include them when compiling your code. For example, if you want to create a function foo() in another file, you need to:
  1. Add a header file Foo.hpp and define foo() there.
  2. Add a cpp file Foo.cpp and implement foo() there.
The #pragma once directive in src/Foo.hpp ensures the header file is included only once during compilation.

Adding dependencies

To add a third-party dependency such as the asio to a C++ project, follow these steps:
1

Add the dependency to vcpkg.json

Run vcpkg add port asio to add the dependency to the vcpkg.json file.
2

Add the dependency to CMakeLists.txt

To be able to use the dependency in your project, you’ll need to add it to CMakeLists.txt.
3

Include the dependency in your code

You can now include the dependency in your code.
On your next push, the test runner will automatically install the dependency before compiling your code.