473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

boost::program_options syntax questions

i'm using the boost:rogram_options and i'm having some problems with
syntax: the code in question is the following:

vector<stringopt;
po:ptions_description desc("Usage");
desc.add_options()
("nodes,n", po::value<vector<string (&opt)->default_value("*"),
"Name of node(s) to print.")
;

/usr/local/include/boost-1_33_1/boost/program_options/
value_semantic.hpp:152: note: candidates are:
boost:rogram_options::typed_value<T, charT>*
boost:rogram_options::typed_value<T, charT>::default_value(const T&)
[with T = std::vector<std::string, std::allocator<std::string,
charT = char]

basically i want to assign the "nodes,n" option a default value of "*"
but i'm not sure what the correct syntax is. i'm trying (&opt)-
>default_value("*") but this works if it were a string. i.e. like
this:

string opt;
desc.add_options()
("nodes,n" po::value<sring(&opt)->default_value("some string"),
"Names of node(s) to print")

what about if i want to make opt a vector<string>? any ideas will be
appreciated.
thanks

Apr 7 '07 #1
0 1358

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: SnaiL | last post by:
I've try to compile simple program which uses boost::program_options and got error like this: LINK : fatal error LNK1104: cannot open file 'libboost_program_options-vc7-mt-s-1_32.lib' I was...
1
by: Hardy | last post by:
Hi, just come into the boost world. just the first.cpp in the program_options examples, with many link error... devc++4.9.9.2, gcc 3.4.2, can I get your opinions on this problem? thank you~ ...
2
by: Starfox | last post by:
The Following Code: //Setup the options string InputName, OutputSkeletonName, OutputModelName; program_options::options_description OptionDesc("Available Options"); OptionDesc.add_options()...
0
by: Krivenok Dmitry | last post by:
I use boost program_options library in my project. But I have one trouble and can't solve it :( I writing simple wrapper class and use generic selector:...
5
by: p_kolya | last post by:
Hello! I'am build boost 1.32, but some libraries (program_options for example) didn't compile because of errors. For example file: boost\program_options\detail\utf8_codecvt_facet.hpp can't be...
1
by: cesco | last post by:
Hi, I'm using the boost library program_options for parsing the command line given to my program as described in the class Parameter: // Main.cpp #include "Parameter.h" using namespace std;...
2
by: MorningStar | last post by:
I wrote the following simple program: //some includes here. int main(int argc, char* argv) { options_description desc("Usage"); desc.add_options()("help", "Show this message.");...
0
by: pallav | last post by:
hi i'm using the boost::program_options and i'm having some problems with syntax: the code in question is the following: vector<string> opt; po::options_description desc("Usage"); ...
1
by: zade | last post by:
Hi all boost::program_options needs be builled into libraries, static or dynamic. I use MSVC7.1 to build the boost::program_options for my project .In my .cpp file , I write: namespace po =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.