From f025cda0afbb8b8b5f16dd6c4944c848d56fd4d0 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Mon, 17 Oct 2016 14:59:07 +0200 Subject: [PATCH] preprocessor: define var for normcdf + msvc. #1259 --- preprocessor/DynamicModel.cc | 30 ++++++++++++++++++++++++++++++ preprocessor/StaticModel.cc | 5 +++++ 2 files changed, 35 insertions(+) diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc index cc16f5aaed..19d7c8445e 100644 --- a/preprocessor/DynamicModel.cc +++ b/preprocessor/DynamicModel.cc @@ -1607,6 +1607,11 @@ DynamicModel::writeDynamicCFile(const string &dynamic_basename, const int order) << " * Warning : this file is generated automatically by Dynare" << endl << " * from model file (.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; if (external_functions_table.get_total_number_of_unique_model_block_external_functions()) @@ -4875,6 +4880,11 @@ DynamicModel::writeResidualsC(const string &basename, bool cuda) const << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; @@ -4926,6 +4936,11 @@ DynamicModel::writeFirstDerivativesC(const string &basename, bool cuda) const << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; @@ -4984,6 +4999,11 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; @@ -5086,6 +5106,11 @@ DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) con << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; @@ -5180,6 +5205,11 @@ DynamicModel::writeThirdDerivativesC_csr(const string &basename, bool cuda) cons << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; diff --git a/preprocessor/StaticModel.cc b/preprocessor/StaticModel.cc index 251cbe1e04..b54f6277c8 100644 --- a/preprocessor/StaticModel.cc +++ b/preprocessor/StaticModel.cc @@ -1597,6 +1597,11 @@ StaticModel::writeStaticCFile(const string &func_name) const << " * Warning : this file is generated automatically by Dynare" << endl << " * from model file (.mod)" << endl << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; if (external_functions_table.get_total_number_of_unique_model_block_external_functions()) -- GitLab