diff --git a/src/error.h b/src/error.h
index de4e9fa44c73d91524dfd307a3ad19b6cad3421f..900d7e1bddbae862ef92db083af8a80d76dddd2d 100644
--- a/src/error.h
+++ b/src/error.h
@@ -131,6 +131,28 @@ extern int engine_rank;
   })
 #endif
 
+/**
+ * @brief Macro to print a localized warning message with variable arguments.
+ *
+ * Same as message(), but this version prints to the standard error and is
+ * flushed immediately.
+ *
+ */
+#ifdef WITH_MPI
+extern int engine_rank;
+#define warning(s, ...)                                                \
+  ({                                                                   \
+    fprintf(stderr, "[%04i] %s %s: WARNING: " s "\n", engine_rank,     \
+            clocks_get_timesincestart(), __FUNCTION__, ##__VA_ARGS__); \
+  })
+#else
+#define warning(s, ...)                                                     \
+  ({                                                                        \
+    fprintf(stderr, "%s %s: WARNING: " s "\n", clocks_get_timesincestart(), \
+            __FUNCTION__, ##__VA_ARGS__);                                   \
+  })
+#endif
+
 /**
  * @brief Assertion macro compatible with MPI
  *