diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc
index 67e4bed07e6d8b6dc13e860531e5a883b05316d5..7480b673f24b660f8a3c348ae4592ab35d1049ec 100644
--- a/preprocessor/ParsingDriver.cc
+++ b/preprocessor/ParsingDriver.cc
@@ -359,10 +359,13 @@ ParsingDriver::add_model_variable(string *name)
   try
     {
       symb_id = mod_file->symbol_table.getID(*name);
+      if (undeclared_model_vars.find(*name) != undeclared_model_vars.end())
+        model_error("Unknown symbol: " + *name);
     }
   catch (SymbolTable::UnknownSymbolNameException &e)
     {
       declare_exogenous(new string (*name));
+      undeclared_model_vars.insert(*name);
       symb_id = mod_file->symbol_table.getID(*name);
     }
   delete name;
@@ -2583,6 +2586,9 @@ ParsingDriver::add_model_var_or_external_function(string *function_name, bool in
             }
           else
             { // e.g. model_var(lag) => ADD MODEL VARIABLE WITH LEAD (NumConstNode)/LAG (UnaryOpNode)
+              if (undeclared_model_vars.find(*function_name) != undeclared_model_vars.end())
+                model_error("Unknown symbol: " + *function_name);
+
               if (stack_external_function_args.top().size() != 1)
                 error(string("Symbol ") + *function_name + string(" is being treated as if it were a function (i.e., has received more than one argument)."));
 
diff --git a/preprocessor/ParsingDriver.hh b/preprocessor/ParsingDriver.hh
index 25e670c40871700b98308139499711125fc9e6bc..91c4ef214308b2cf8ebb81d5839d3beddffb2304 100644
--- a/preprocessor/ParsingDriver.hh
+++ b/preprocessor/ParsingDriver.hh
@@ -184,6 +184,8 @@ private:
   //! Temporary storage for current restriction number in svar_identification block
   map<int,int> svar_Qi_restriction_nbr;
   map<int,int> svar_Ri_restriction_nbr;
+  //! Stores undeclared model variables
+  set<string> undeclared_model_vars;
   //! Temporary storage for restriction type
   enum SvarRestrictionType
     {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bcc8c87b0ae35235b29ba475422bb265a976c6b7..6ceea66ee865d101b5bc8d0e550d4f9bae98d348 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -329,7 +329,8 @@ XFAIL_MODFILES = ramst_xfail.mod \
 	optimal_policy/Ramsey/ramsey_ex_wrong_ss_file_xfail.mod \
 	estimation/fs2000_mixed_ML_xfail.mod \
 	identification/ident_unit_root/ident_unit_root_xfail.mod \
-	steady_state/Linear_steady_state_xfail.mod
+	steady_state/Linear_steady_state_xfail.mod \
+	example1_undeclared_vars_xfail.mod
 
 MFILES = initval_file/ramst_initval_file_data.m
 
diff --git a/tests/example1_undeclared_vars_xfail.mod b/tests/example1_undeclared_vars_xfail.mod
new file mode 100644
index 0000000000000000000000000000000000000000..ae506c76a34901379240c25e4c8aa2aa5ff5a79d
--- /dev/null
+++ b/tests/example1_undeclared_vars_xfail.mod
@@ -0,0 +1,51 @@
+// Example 1 from Collard's guide to Dynare
+var y, k, a, h, b;
+varexo e;
+
+verbatim;
+% I want these comments included in
+% example1.m 1999q1 1999y
+%
+var = 1;
+end;
+
+parameters beta, rho, alpha, delta, theta, psi;
+
+alpha = 0.36;
+rho   = 0.95;
+tau   = 0.025;
+beta  = 0.99;
+delta = 0.025;
+psi   = 0;
+theta = 2.95;
+
+phi   = 0.1;
+
+model;
+c*theta*h^(1+psi)=(1-alpha)*y;
+k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
+    *(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
+y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
+k = exp(b)*(y-c)+(1-delta)*k(-1);
+a = rho*a(-1)+tau*b(-1) + e;
+b = tau*a(-1)+rho*b(-1) + u;
+end;
+
+initval;
+y = 1.08068253095672;
+c = 0.80359242014163;
+h = 0.29175631001732;
+k = 11.08360443260358;
+a = 0;
+b = 0;
+e = 0;
+u = 0;
+end;
+
+shocks;
+var e; stderr 0.009;
+var u; stderr 0.009;
+var e, u = phi*0.009*0.009;
+end;
+
+stoch_simul;