Learn how to solve CodeCrafters challenges in C++
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:
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.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:
Foo.hpp
and define foo()
there.Foo.cpp
and implement foo()
there.#pragma once
directive in src/Foo.hpp
ensures the header file is included only once during compilation.asio
to a C++ project, follow these steps:
Add the dependency to vcpkg.json
vcpkg add port asio
to add the dependency to the vcpkg.json
file.Add the dependency to CMakeLists.txt
CMakeLists.txt
.Include the dependency in your code