English 中文(简体)
Boost.program_options:/2006/10_ Value and Unicode results in codification-time mis
原标题:Boost.program_options: implicit_value and Unicode results in compile-time error
  • 时间:2011-10-25 14:24:47
  •  标签:
  • c++
  • boost

我正在使用Boost.program_options Library,需要在统法协会的支持下明确含蓄价值。

为绕行这一法典,可处以罚款。

po::options_description desc("Usage");
desc.add_options()
    ("help,h", "produce help message")
    ("-option,o", po::value<std::string>()->implicit_value(""), "descr");

但是,如果我使用统法协会的支持就象这样。

po::options_description desc("Usage");
desc.add_options()
    ("help,h", "produce help message")
    ("-option,o", po::wvalue<std::wstring>()->implicit_value(L""), "descr");

我有以下错误:

boost/lexical_cast.hpp(1096): error C2039:  setg  : is not a member of  boost::detail::lexical_stream_limited_src<CharT,Base,Traits> 

boost/lexical_cast.hpp(1097): error C2664:  std::basic_istream<_Elem,_Traits>::basic_istream(std::basic_streambuf<_Elem,_Traits> *,bool)  : cannot convert parameter 1 from  base *  to  std::basic_streambuf<_Elem,_Traits> * 

boost/lexical_cast.hpp(1103): error C2678: binary  >>  : no operator found which takes a left-hand operand of type  std::basic_istream<_Elem,_Traits>  (or there is no acceptable conversion)

什么是错了?

问题回答

在试图利用统法协会支持的缺省——价值方法时,我有同样的错误。 然而,在审视了“蓝色源码”之后,似乎统法协会在方案-选择方面的支持不完整(或者说是使用这种系统所需要的文件)。 看来,使用隐含的“价值和(或)违约”方法实际上与错误无关;而是使用价值与价值。

这实际上与<代码>boost:lexical_cast< end:string, end:wstring >。 我刚刚为这个网站设定了错误票:here。 现在,你可以使用2个参数的超负荷,并提供文字代表。 这也适用于<代码>default_ Value方法。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签