diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 6ac66420f2096d9f338ddfae7510ef648c1a2659..902bf4821c259183acee8dc9f9c5d30a3cfa4b36 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -2955,14 +2955,14 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
       outstruct = "oo_.";
     }
 
-  if (max_endo_lag_by_var.size() != symbol_table.orig_endo_nbr())
+  if (max_endo_lag_by_var.size() != static_cast<size_t>(symbol_table.orig_endo_nbr()))
     {
       cerr << "ERROR: the number of endogenous variables found in the model block"
            << " is not equal to the number declared" << endl;
       exit(EXIT_FAILURE);
     }
 
-  if (max_exo_lag_by_var.size() != symbol_table.exo_nbr())
+  if (max_exo_lag_by_var.size() != static_cast<size_t>(symbol_table.exo_nbr()))
     {
       cerr << "ERROR: the number of exogenous variables found in the model block"
            << " is not equal to the number declared" << endl;