D++ (DPP)
C++ Discord API Bot Library
Building on OSX

1. Toolchain

Before compiling make sure you have all the tools installed.

  1. To install the dependencies, this guide will use Homebrew which has an installation guide on their project page.
  2. This project uses CMake to generate the makefiles. Install it with brew install cmake.

2. Install External Dependencies

brew install openssl pkgconfig
Note
Usually, you do not need pkgconfig. However, it seems that it throws errors about openssl without.

For voice support, additional dependencies are required:

brew install libsodium opus

3. Build Source Code

cmake -B ./build
cmake --build ./build -j8

Replace the number after -j with a number suitable for your setup, usually the same as the number of cores on your machine. cmake will fetch any dependencies that are required for you and ensure they are compiled alongside the library.

4. Install Globally

cd build
sudo make install

5. Installation to a Different Directory

If you want to install the library, its dependencies, and header files to a different directory, specify this directory when running cmake:

cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install

Then once the build is complete, run sudo make install to install to the location you specified.

6. Using the Library

Once installed, you can make use of the library in standalone programs simply by including it and linking to it:

clang++ -std=c++17 -ldpp mydppbot.cpp -o dppbot

The important flags in this command-line are:

  • -std=c++17 - Required to compile the headers
  • -ldpp - Link to libdpp.dylib
  • mydppbot.cpp - Your source code
  • dppbot - The name of the executable to make

Note
Compiling your bot with a raw g++ command is not advised in any real project, and the example above should be used only as a test. From here, you should learn to create a bot in D++ by moving on to Building a Discord Bot Using CMake (UNIX) or if you have not yet created a token for your bot, Creating a Bot Token - If you are having trouble setting up CMake, you can try our template cmake bot project.

Have fun!

D++ Library version 10.0.35D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0