MStrechen's blog

By MStrechen, history, 8 years ago, In English

Hello everyone.

Does anyone knows why this 25250650 can't be compiled using GNU C++14, but is successfully compiled using C++11? Is there any reason?

  • Vote: I like it
  • +13
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it +31 Vote: I do not like it

That's because you haven't included the needed header file. std::accumulate is declared in <numeric>, not <algorithm> (Refer to CPP Reference). I'm not sure how it compiles in C++11, though.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    Probably one of the other headers includes <numeric> implicitly.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    Thanks, this has helped