Boost logo

Boost Users :

From: Elisha Berns (e.berns_at_[hidden])
Date: 2005-05-27 15:22:53


Hi,

I have a few questions about Boost.ProgramOptions pertaining to parsing
an argv that is of wchar_t data type. The first thing that isn't clear
from the examples is whether it's possible at all. The second thing
that isn't clear is how to do it and store string values in std::wstring
variables.

Here are the specifics:

1) How do you use program_options with an argv argument that is a
wchar_t data type?

Like this?

        variables_map vm;
        store(parse_command_line<wchar_t>(argc, argv, desc), vm);

but then the question is how do you store any of the command line values
in wstring variables?

Like this?

    options_description desc("allowed options");
    desc.add_options()
                // First parameter describes option name/short name
                // The second is parameter to option
                // The third is description
                ("help,h", "print usage message")
                ("validate,v", value(&strFile), "validate xml file");

// strFile is a wstring

Well that doesn't work.

2) I am getting 3 link errors when trying the above:

ToolsTest.obj : error LNK2019: unresolved external symbol "void __cdecl
boost::program_options::store(class
boost::program_options::basic_parsed_options<unsigned short> const
&,class boost::program_options::variables_map &)"
(?store_at_program_options_at_boost@@YAXABV?$basic_parsed_options_at_G@12_at_AAVvari
ables_map_at_12@@Z) referenced in function _main

ToolsTest.obj : error LNK2019: unresolved external symbol "public:
__thiscall boost::program_options::basic_parsed_options<unsigned
short>::basic_parsed_options<unsigned short>(class
boost::program_options::basic_parsed_options<char> const &)"
(??0?$basic_parsed_options_at_G@program_options_at_boost@@QAE_at_ABV?$basic_parse
d_options_at_D@12@@Z) referenced in function "public: class
boost::program_options::basic_parsed_options<unsigned short> __thiscall
boost::program_options::basic_command_line_parser<unsigned
short>::run(void)const "
(?run@?$basic_command_line_parser_at_G@program_options_at_boost@@QBE?AV?$basic
_parsed_options_at_G@23_at_XZ)

ToolsTest.obj : error LNK2019: unresolved external symbol "class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > __cdecl boost::program_options::to_internal(class
std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > const &)"
(?to_internal_at_program_options_at_boost@@YA?AV?$basic_string_at_DU?$char_traits
@D_at_std@@V?$allocator_at_D@2@@std@@ABV?$basic_string_at_GU?$char_traits_at_G@std@@
V?$allocator_at_G@2@@4@@Z) referenced in function "class std::vector<class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >,class std::allocator<class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > > > __cdecl
boost::program_options::to_internal<class std::basic_string<unsigned
short,struct std::char_traits<unsigned short>,class
std::allocator<unsigned short> > >(class std::vector<class
std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> >,class std::allocator<class
std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > > > const &)"
(??$to_internal_at_V?$basic_string_at_GU?$char_traits_at_G@std@@V?$allocator_at_G@2@
@std@@@program_options_at_boost@@YA?AV?$vector_at_V?$basic_string_at_DU?$char_tra
its_at_D@std@@V?$allocator_at_D@2@@std@@V?$allocator_at_V?$basic_string_at_DU?$char_
traits_at_D@std@@V?$allocator_at_D@2@@std@@@2@@std@@ABV?$vector_at_V?$basic_strin
g_at_GU?$char_traits_at_G@std@@V?$allocator_at_G@2@@std@@V?$allocator_at_V?$basic_st
ring_at_GU?$char_traits_at_G@std@@V?$allocator_at_G@2@@std@@@2@@3@@Z)

Thanks for any help here,

Elisha Berns
e.berns_at_[hidden]
tel. (310) 556 - 8332
fax (310) 556 - 2839


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net