c:\Users\admin\Documents\sublimecmd>g++ -std=c++11 hw8.cpp -o hw8.exe
In file included from C:/TDM-GCC-32/lib/gcc/mingw32/5.1.0/include/c++/algorithm:
62:0,
from hw8.cpp:8:
C:/TDM-GCC-32/lib/gcc/mingw32/5.1.0/include/c++/bits/stl_algo.h: In instantiatio
n of '_Funct std::for_each(_IIter, _IIter, _Funct) [with _IIter = std::istream_i
terator<std::__cxx11::basic_string<char> >; _Funct = main()::<lambda(std::__cxx1
1::string&)>]':
hw8.cpp:18:92: required from here
C:/TDM-GCC-32/lib/gcc/mingw32/5.1.0/include/c++/bits/stl_algo.h:3767:5: error: n
o match for call to '(main()::<lambda(std::__cxx11::string&)>) (const std::__cxx
11::basic_string<char>&)'
__f(*__first);
^
hw8.cpp:18:82: note: candidate: main()::<lambda(std::__cxx11::string&)> <near ma
tch>
for_each(istream_iterator<string>(in), istream_iterator<string>(),[&](string &
s){m[s]++;});
^
hw8.cpp:18:82: note: conversion of argument 1 would be ill-formed:
In file included from C:/TDM-GCC-32/lib/gcc/mingw32/5.1.0/include/c++/algorithm:
62:0,
from hw8.cpp:8:
C:/TDM-GCC-32/lib/gcc/mingw32/5.1.0/include/c++/bits/stl_algo.h:3767:5: error: b
inding 'const std::__cxx11::basic_string<char>' to reference of type 'std::__cxx
11::string& {aka std::__cxx11::basic_string<char>&}' discards qualifiers
__f(*__first);
what does this even mean? Am I supposed to "enable" c++11? I thought it should already be the standard compiler version by default, considering I only installed TDM-GCC 2 or 3 months ago.
I think you still have to enable C++11 even in the latest versions of GCC. The problem if they changed this is that it would break a lot of people's build scripts because C++11 is not completely backward compatible with earlier standards.