diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc
index 0e234234ebea78b29b7ee1de4ae124b105a8b670..6fd26157ee06fb57eb690ebae12930fcc6fa1d2e 100644
--- a/src/macro/Directives.cc
+++ b/src/macro/Directives.cc
@@ -254,7 +254,7 @@ If::interpret(ostream &output, Environment &env, 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())))