Sentry and C++

Crash Reporting

If your program is running on more than one machine or is used by others, you probably want to get some insight into when things fail. I believe this is commonly called “Crash Reporting”.

Such a crash reporting system will consist of a component to collect individual incidents and of a component to aggregate individual reports. For example, it will group common incidents by stack trace.

One public example of this, is Mozilla’s system (Socorro). Have a look here for statistics on all of Mozilla’s projects. Or here, for just the top ten Firefox crashes from a specific version:

Top 10 Firefox Crashes

The Top 10 Firefox Crashes

I don’t want to run my own server infrastructure, and have been using Sentry. Sentry is a SaaS offering for crash reporting and analytics1. Sentry has been a breeze to use. It is free for single-user projects and I have been playing around with it for some time with Python, Rust and React.

Unfortunately, with C++ I have been stuck. provides Sentry-Native which is essentially a C-style library. I’ve tried a few times to get it working and failed. However, last Friday I found crow, which is a C++ library for Sentry.

An example

#include <crow/crow.hpp>

int main(void) {
  nlohmann::crow sentry("");
  sentry.capture_message("Hello, Sentry!");

  printf("Hello, World!\n");

For your own project, you want to replace the project ID and the public key. Otherwise, your crash reports will go to me.

If we check on Sentry, we’ll see the issue show up here:

Our issue on Sentry

The issue we just caused shows up on Sentry.

I’ve put the code on Github for your convenience:

Please let me know your feedback on Twitter.

  1. There’s also If you work for, please openly publish your pricing structure (I found it in your FAQ through Google: it starts at $99 per month.). Also, please have a free tier to let developers test your service. (And no, your 30-day trial is not good enough.) ↩︎