Opened 16 years ago

Closed 15 years ago

#878 closed Bugs (fixed)

error C2039: 'mbstate_t' : is not a member of 'std'

Reported by: farid_zaripov Owned by: Robert Ramey
Milestone: Component: serialization
Version: None Severity: Showstopper
Keywords: Cc:

Description

I have been working on the Apache C++ Standard Library project (STDCXX):
http://incubator.apache.org/stdcxx/

I've trying to compile the boost library with stdcxx.

The details can be found here:
http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200704.mbox/%
3c7BDB2168BEAEF14C98F1901FD2DE64386573EB@epmsa009.minsk.epam.com%3e

Boost version: 1.33.1
STDCXX version: 4.2

I've got the following error in boost/detail/utf8_codecvt_facet.hpp; boost/archive/codecvt_null.hpp:


D:\_Libs\boost_1_33_1\boost\detail\utf8_codecvt_facet.hpp(116) : error C2039: 'mbstate_t' : is not a member of 'std'
D:\_Libs\boost_1_33_1\boost\detail\utf8_codecvt_facet.hpp(124) : error C2039: 'mbstate_t' : is not a member of 'std'
D:\_Libs\boost_1_33_1\boost\detail\utf8_codecvt_facet.hpp(134) : error C2039: 'mbstate_t' : is not a member of 'std'
D:\_Libs\boost_1_33_1\boost\detail\utf8_codecvt_facet.hpp(163) : error C2039: 'mbstate_t' : is not a member of 'std'
D:\_Libs\boost_1_33_1\boost\detail\utf8_codecvt_facet.hpp(181) : error C2039: 'mbstate_t' : is not a member of 'std'
d:\_Libs\boost_1_33_1\libs\program_options\src\../../detail\utf8_codecvt_facet.cpp(35) : error C2039: 'mbstate_t' : is not a member of 'std'
d:\_Libs\boost_1_33_1\libs\program_options\src\../../detail\utf8_codecvt_facet.cpp(112) : error C2039: 'mbstate_t' : is not a member of 'std'
d:\_Libs\boost_1_33_1\libs\program_options\src\../../detail\utf8_codecvt_facet.cpp(174) : error C2039: 'mbstate_t' : is not a member of 'std'

    CALL "C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\bin\VCVARS32.BAT" >nul 
    "C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\bin\cl"  /Zm800 -nologo /EHsc -c  -D_RWSTDDEBUG  /Z7 /Od /Ob0 /EHsc /GR /MTd /Op  /wd4675 /Zc:forScope  -I"bin\boost\libs\program_options\build" -I"D:\_Libs\boost_1_33_1"  -I"D:\_Projects\stdcxx_working\include" -I"D:\_Projects\stdcxx_working\include\ansi" -I"D:\_Projects\stdcxx_working\build\msvc-7.1\15s\include"  -I"D:\_Libs\boost_1_33_1"   -Fo"bin\boost\libs\program_options\build\libboost_program_options.lib\vc-7_1-stdcxx\debug\runtime-link-static\threading-multi\utf8_codecvt_facet.obj"  -Tp"D:\_Libs\boost_1_33_1\libs\program_options\build\../src/utf8_codecvt_facet.cpp" 




D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(45) : error C2039: 'mbstate_t' : is not a member of 'std'
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(45) : error C2065: 'mbstate_t' : undeclared identifier
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(46) : error C2955: 'std::codecvt' : use of class template requires template argument list
        D:\_Projects\stdcxx_working\include\loc/_codecvt.h(164) : see declaration of 'std::codecvt'
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(57) : error C2039: 'mbstate_t' : is not a member of 'std'
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(58) : error C2955: 'std::codecvt' : use of class template requires template argument list
        D:\_Projects\stdcxx_working\include\loc/_codecvt.h(164) : see declaration of 'std::codecvt'
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(61) : error C2039: 'mbstate_t' : is not a member of 'std'
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(61) : error C2061: syntax error : identifier 'mbstate_t'
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(71) : error C2039: 'mbstate_t' : is not a member of 'std'
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(71) : error C2061: syntax error : identifier 'mbstate_t'
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(52) : error C2039: 'mbstate_t' : is not a member of 'std'
D:\_Libs\boost_1_33_1\boost/archive/codecvt_null.hpp(53) : error C2542: 'codecvt' : class object has no constructor for initialization

    CALL "D:\Program Files\Microsoft Visual Studio 8\Common7\Tools\..\..\VC\bin\vcvars32.BAT" >nul 
    "D:\Program Files\Microsoft Visual Studio 8\Common7\Tools\..\..\VC\bin\cl"  /Zm800 -nologo /EHsc -c  -DBOOST_LIB_DIAGNOSTIC=1 -D_RWSTDDEBUG  /Z7 /Od /Ob0 /EHsc /GR /MTd  -Gy -wd4996 /Zc:forScope /Zc:wchar_t  -I"bin\boost\libs\serialization\build"  -I"D:\_Projects\stdcxx_working\include" -I"D:\_Projects\stdcxx_working\include\ansi" -I"D:\_Projects\stdcxx_working\build\msvc-8.0\15s\include"  -I"D:\_Libs\boost_1_33_1"   -Fo"bin\boost\libs\serialization\build\libboost_serialization.lib\vc-8_0-stdcxx\debug\runtime-link-static\threading-multi\basic_text_iprimitive.obj"  -Tp"D:\_Libs\boost_1_33_1\libs\serialization\build\../src/basic_text_iprimitive.cpp" 


I propose to #include <wchar.h> in codecvt_null.hpp and  add the following lines in both files:

    #elif defined(BOOST_RWSTD_VER)
        using ::mbstate_t;

Change History (7)

comment:1 by anonymous, 15 years ago

I've added this to my local version for testing. Assuming no problems, it will appear in 1.35

comment:2 by farid_zaripov, 15 years ago

The cross-reference link to the Apache STDCXX issue tracker: http://issues.apache.org/jira/browse/STDCXX-430

comment:3 by farid_zaripov <faridz@…>, 15 years ago

May I hope that the changes will appear in 1.34.1?

comment:4 by Robert Ramey, 15 years ago

Resolution: Nonefixed
Severity: Showstopper
Status: assignedclosed

comment:5 by faridz@…, 15 years ago

Resolution: fixed
Status: closedreopened

Ticked fixed not completely:

..\boost\archive\codecvt_null.hpp(37) : error C2039: 'mbstate_t' : is not a member of 'operator``global namespace'''
..\boost\archive\codecvt_null.hpp(37) : error C2873: 'mbstate_t' : symbol cannot be used in a using-declaration
..\boost\archive\codecvt_null.hpp(48) : error C2039: 'mbstate_t' : is not a member of 'std'
..\boost\archive\codecvt_null.hpp(48) : error C2065: 'mbstate_t' : undeclared identifier
..\boost\archive\codecvt_null.hpp(48) : error C2955: 'std::codecvt' : use of class template requires template argument list
        D:\stdcxx\4.2.x\include\loc\_codecvt.h(171) : see declaration of 'std::codecvt'
..\boost\archive\codecvt_null.hpp(60) : error C2039: 'mbstate_t' : is not a member of 'std'
..\boost\archive\codecvt_null.hpp(60) : error C3861: 'mbstate_t': identifier not found, even with argument-dependent lookup
..\boost\archive\codecvt_null.hpp(60) : error C2955: 'std::codecvt' : use of class template requires template argument list
        D:\stdcxx\4.2.x\include\loc\_codecvt.h(171) : see declaration of 'std::codecvt'
..\boost\archive\codecvt_null.hpp(64) : error C2039: 'mbstate_t' : is not a member of 'std'
..\boost\archive\codecvt_null.hpp(64) : error C2061: syntax error : identifier 'mbstate_t'
..\boost\archive\codecvt_null.hpp(74) : error C2039: 'mbstate_t' : is not a member of 'std'
..\boost\archive\codecvt_null.hpp(74) : error C2061: syntax error : identifier 'mbstate_t'

The patch:

Index: boost/archive/codecvt_null.hpp
===================================================================
--- boost/archive/codecvt_null.hpp	(revision 42906)
+++ boost/archive/codecvt_null.hpp	(working copy)
@@ -18,6 +18,7 @@
 
 #include <locale>
 #include <cstddef>
+#include <wchar.h>   // for mbstate_t
 
 #include <boost/config.hpp>
 #include <boost/archive/detail/auto_link_archive.hpp>

comment:6 by faridz@…, 15 years ago

The error in utf8_codecvt_facet.hpp:

utf8_codecvt_facet.cpp
..\boost/detail/utf8_codecvt_facet.hpp(114) : error C2039: 'mbstate_t' : is not a member of 'std'
..\boost/detail/utf8_codecvt_facet.hpp(122) : error C2039: 'mbstate_t' : is not a member of 'std'
..\boost/detail/utf8_codecvt_facet.hpp(132) : error C2039: 'mbstate_t' : is not a member of 'std'
..\boost/detail/utf8_codecvt_facet.hpp(161) : error C2039: 'mbstate_t' : is not a member of 'std'
..\boost/detail/utf8_codecvt_facet.hpp(179) : error C2039: 'mbstate_t' : is not a member of 'std'
..\boost/detail/utf8_codecvt_facet.hpp(117) : error C2039: 'mbstate_t' : is not a member of 'std'
..\libs/detail/utf8_codecvt_facet.cpp(35) : error C2039: 'mbstate_t' : is not a member of 'std'
..\libs/detail/utf8_codecvt_facet.cpp(112) : error C2039: 'mbstate_t' : is not a member of 'std'
..\libs/detail/utf8_codecvt_facet.cpp(174) : error C2039: 'mbstate_t' : is not a member of 'std'

The patch:

Index: boost/detail/utf8_codecvt_facet.hpp
===================================================================
--- boost/detail/utf8_codecvt_facet.hpp	(revision 42908)
+++ boost/detail/utf8_codecvt_facet.hpp	(working copy)
@@ -96,6 +96,8 @@
     #elif defined(BOOST_NO_STDC_NAMESPACE)
         using ::mbstate_t;
         using ::codecvt;
+    #elif defined(BOOST_RWSTD_VER)
+        using ::mbstate_t;
     #endif
 } // namespace std

comment:7 by Robert Ramey, 15 years ago

Resolution: fixed
Status: reopenedclosed

OK - I made the change in my local system.

Should appear on Boost 1.36

Note: See TracTickets for help on using tickets.