AMICI-dev/AMICI

'reduce' is not a member of 'std' std::reduce(idlist.begin(), idlist.end())

Opened this issue · 1 comments

What did you expect to happen?
After installing AMICI and making sure to run mex -setup C++, I used the model examples in \models. For example rebuild_model_robertson. I expect it would just compile.

What has happened instead?
There was an error in using "std::reduce(idlist.begin(), idlist.end())" in the file \include/amici/model_dae.h:62:13.
I checked the version of C++, but in the command line before outputting the error it says mex COPTIMFLAGS=' -DNDEBUG' CXXFLAGS='$CXXFLAGS -std=c++17' -c -outdir "C:\Users...", which includes c++17, which should support std::reduce.

To Reproduce
Compile an example by running rebuild_model_robertson
Steps to reproduce the behavior
Ideally include minimal code examples here

AMICI version and system environment

  • OS and version: Windows 11
  • AMICI interface: Matlab
  • AMICI version: 0.25.1
  • Additional information: Matlab 2017b with MinGW-w64 C/C++ compiler for Windows version 5.3

How to fix
Do you know how to resolve the problem?
No, I have been trying for hours to find a solution. I am not experienced with c++.
Can you submit a pull request?

Thank you for the help

Hi @derleanfv, the matlab-mingw compiler seems to be too old too support C++17.

I don't have any Windows machine available to test this, but can you try:

  1. Download a recent mingw version from https://www.mingw-w64.org/downloads/
  2. Configure matlab as described here
  3. retry what you did before (ignoring any warnings that this version of mingw is not compatible with that matlab release)