Boost C++ Libraries: Ticket #8208: param of xpressive::sregex_iterator compiler error in VS2012 https://svn.boost.org/trac10/ticket/8208 <p> Windows7 64bit, MS Visual Studio 2012 (VC11), build with 32bit; </p> <p> I just compiler example code in user's guide, "Find all the sub-strings that match a regex and step through them one at a time" : </p> <blockquote> <p> std::wstring str( L"This is his face." ); wsregex token = +alnum; wsregex_iterator cur( str.begin(), str.end(), token ); <em>&lt;---error wsregex_iterator end; </em></p> </blockquote> <p> for( ; cur != end; ++cur ) { </p> <blockquote> <p> wsmatch const &amp;what = *cur; std::wcout &lt;&lt; what<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> &lt;&lt; L'\n'; </p> </blockquote> <p> } </p> <p> compiler said undeclared identifier of "token" in "wsregex_iterator cur( str.begin(), str.end(), token );" !!! </p> <p> I changed the var "token" to "tt_k", it report same error still. The sample code compiler OK in VS2010, but fail in VS2012. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8208 Trac 1.4.3 Eric Niebler Wed, 06 Mar 2013 16:25:02 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8208#comment:1 https://svn.boost.org/trac10/ticket/8208#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> <p> I copied the code exactly as it is from that example, pasted it into a brand new VS2012 project, hit compile, and it worked. For reference, the code is here: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/xpressive/xpressive.hpp&gt; using namespace boost::xpressive; int main() { std::wstring str( L"This is his face." ); // find a whole word wsregex token = +alnum; wsregex_iterator cur( str.begin(), str.end(), token ); wsregex_iterator end; for( ; cur != end; ++cur ) { wsmatch const &amp;what = *cur; std::wcout &lt;&lt; what[0] &lt;&lt; L'\n'; } return 0; } </pre> Ticket