Skip to main content

C++ Installation Instructions

C++ is currently only supported for iOS and Linux. We will publish binaries for Windows and macOS soon. Please let us know if these binaries are important for your timeline by emailing us at contact@ditto.live.

  1. To start integrating Ditto into your app you need to download a copy of the libditto.a static library and the Ditto.h header. The following command will download and then unpack an archive containing the library and header. The URL in the following command will download a copy of the static library built to work on iOS:
curl -O https://software.ditto.live/cpp-ios/Ditto/1.0.9/dist/Ditto.tar.gz && tar xvfz Ditto.tar.gz

If you want to download the C++ SDK for usage on Linux x86_64 then use the following command, which uses a different URL:

curl -O https://software.ditto.live/cpp-linux-x86_64/Ditto/1.0.9/dist/Ditto.tar.gz && tar xvfz Ditto.tar.gz
  1. Configure your app to link to the Ditto static library. Usually, this will mean adding an -lditto to a compilation step for your app.
  1. Now, in your C++ code, you can import ditto with: #include <Ditto.h>
int main() {    auto identity = ditto::Identity();    std::unique_ptr<ditto::Ditto> ditto(new ditto::Ditto(identity));    ditto->try_start_sync()    return 0;}