diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc
index dde0b377a1f0a179ff6614161b0cdc59d9828bc0..d87de87a7fc5017db0fff9c73f175fee89a1274e 100644
--- a/src/macro/Directives.cc
+++ b/src/macro/Directives.cc
@@ -254,7 +254,7 @@ If::interpret(ostream &output, vector<filesystem::path> &paths)
             first_clause = false;
             VariablePtr vp = dynamic_pointer_cast<Variable>(expr);
             if (!vp)
-              error(StackTrace(ifdef ? "@#ifdef" : "@ifndef",
+              error(StackTrace(ifdef ? "@#ifdef" : "@#ifndef",
                                "The condition must be a variable name", location));
             if ((ifdef && env.isVariableDefined(vp->getName()))
                 || (ifndef && !env.isVariableDefined(vp->getName())))