diff --git a/mex/sources/bytecode/ErrorHandling.hh b/mex/sources/bytecode/ErrorHandling.hh
index 066c4f79c266df24f6ff61cc7813bd3a76e6939f..1443c227fd83bc88d46a92f87c8d3670fc6c3e25 100644
--- a/mex/sources/bytecode/ErrorHandling.hh
+++ b/mex/sources/bytecode/ErrorHandling.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2007-2023 Dynare Team
+ * Copyright © 2007-2024 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -109,6 +109,8 @@ test_mxMalloc(void* z, int line, const string& file, const string& func, int amo
 
 #ifdef MATLAB_MEX_FILE
 extern "C" bool utIsInterruptPending();
+#else
+# include <octave/quit.h>
 #endif
 
 #endif
diff --git a/mex/sources/bytecode/Evaluate.cc b/mex/sources/bytecode/Evaluate.cc
index cf5591a0c2b66e41f30f44ab287a309d052c1502..8b631f1f4e0f6db864d4a6568e3dfea0782b364d 100644
--- a/mex/sources/bytecode/Evaluate.cc
+++ b/mex/sources/bytecode/Evaluate.cc
@@ -417,6 +417,8 @@ Evaluate::print_expression(const Evaluate::it_code_type& expr_begin,
 #ifdef MATLAB_MEX_FILE
       if (utIsInterruptPending())
         throw UserException {};
+#else
+      OCTAVE_QUIT;
 #endif
       switch ((*it_code)->tag)
         {
@@ -1004,6 +1006,8 @@ Evaluate::evaluateBlock(int it_, int y_kmin, double* __restrict__ y, int y_size,
 #ifdef MATLAB_MEX_FILE
   if (utIsInterruptPending())
     throw UserException {};
+#else
+  OCTAVE_QUIT;
 #endif
 
   while (go_on)
diff --git a/mex/sources/bytecode/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc
index 3422932800867fded598f3520da206ffcd390ce9..aa7f77bdebc95d6ed696e82075629a450cf5a3f6 100644
--- a/mex/sources/bytecode/Interpreter.cc
+++ b/mex/sources/bytecode/Interpreter.cc
@@ -3642,6 +3642,8 @@ Interpreter::Solve_ByteCode_Symbolic_Sparse_GaussianElimination(bool symbolic)
 #ifdef MATLAB_MEX_FILE
       if (utIsInterruptPending())
         throw UserException {};
+#else
+      OCTAVE_QUIT;
 #endif
 
       if (record && symbolic)