diff --git a/lib/database-private.h b/lib/database-private.h index 5bb6e86c..41918d76 100644 --- a/lib/database-private.h +++ b/lib/database-private.h @@ -21,6 +21,15 @@ #ifndef NOTMUCH_DATABASE_PRIVATE_H #define NOTMUCH_DATABASE_PRIVATE_H +/* According to WG14/N1124, a C++ implementation won't provide us a + * macro like PRIx64 (which gives a printf format string for + * formatting a uint64_t as hexadecimal) unless we define + * __STDC_FORMAT_MACROS before including inttypes.h. That's annoying, + * but there it is. + */ +#define __STDC_FORMAT_MACROS +#include + #include "notmuch-private.h" #include diff --git a/lib/database.cc b/lib/database.cc index 86413215..2b5b64df 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1306,7 +1306,7 @@ _notmuch_database_generate_thread_id (notmuch_database_t *notmuch) notmuch->last_thread_id++; - sprintf (thread_id, "%016llx", notmuch->last_thread_id); + sprintf (thread_id, "%016" PRIx64, notmuch->last_thread_id); db->set_metadata ("last_thread_id", thread_id);