473,785 Members | 2,919 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

the usage message generated by boost::program_ options.

I wrote the following simple program:

//some includes here.
int main(int argc, char* argv[]) {
options_descrip tion desc("Usage");
desc.add_option s()("help", "Show this message.");
desc.add_option s()("config,c", value<string>() , "Specify the
configuration file.");

variables_map vm;
store(parse_com mand_line(argc, argv, desc), vm);
notify(vm);

if(vm.count("he lp")) {
cout << desc << endl;
return 0;
}

return 0;
}

And using the "--help" command line argument, it genrated the
following program usage:
Usage:
--help Show this message.
-c [ --config ] arg Specify the configuration file.

Who knows how to turn the "arg" in the last line into something more
meaningful, say, "file"?.
In other words, how to generate the last line as:
-c [ --config ] <fileSpecify the configuration file.

Mar 22 '07 #1
2 3048
On Mar 22, 9:32 am, "MorningSta r" <steedho...@163 .netwrote:
I wrote the following simple program:

//some includes here.
int main(int argc, char* argv[]) {
options_descrip tion desc("Usage");
desc.add_option s()("help", "Show this message.");
desc.add_option s()("config,c", value<string>() , "Specify the
configuration file.");

variables_map vm;
store(parse_com mand_line(argc, argv, desc), vm);
notify(vm);

if(vm.count("he lp")) {
cout << desc << endl;
return 0;
}

return 0;

}

And using the "--help" command line argument, it genrated the
following program usage:
Usage:
--help Show this message.
-c [ --config ] arg Specify the configuration file.

Who knows how to turn the "arg" in the last line into something more
meaningful, say, "file"?.
In other words, how to generate the last line as:
-c [ --config ] <fileSpecify the configuration file.
I bet the folks on the Boost User List do (see http://boost.org/more/mailing_lists.htm#users).
Your question as stated is off-topic here (http://www.parashift.com/c+
+-faq-lite/how-to-post.html#faq-5.9).

Cheers! --M

Mar 22 '07 #2
On 3ÔÂ22ÈÕ, ÏÂÎç10ʱ07·Ö, "mlimber" <mlim...@gmail. comwrote:
On Mar 22, 9:32 am, "MorningSta r" <steedho...@163 .netwrote:


I wrote the following simple program:
//some includes here.
int main(int argc, char* argv[]) {
options_descrip tion desc("Usage");
desc.add_option s()("help", "Show this message.");
desc.add_option s()("config,c", value<string>() , "Specify the
configuration file.");
variables_map vm;
store(parse_com mand_line(argc, argv, desc), vm);
notify(vm);
if(vm.count("he lp")) {
cout << desc << endl;
return 0;
}
return 0;
}
And using the "--help" command line argument, it genrated the
following program usage:
Usage:
--help Show this message.
-c [ --config ] arg Specify the configuration file.
Who knows how to turn the "arg" in the last line into something more
meaningful, say, "file"?.
In other words, how to generate the last line as:
-c [ --config ] <fileSpecify the configuration file.

I bet the folks on the Boost User List do (seehttp://boost.org/more/mailing_lists.h tm#users).
Your question as stated is off-topic here (http://www.parashift.com/c+
+-faq-lite/how-to-post.html#faq-5.9).

Cheers! --M- Òþ²Ø±»ÒýÓÃÎÄ×Ö -

- ÏÔʾÒýÓõÄÎÄ×Ö -
Thanks.

Mar 23 '07 #3

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

Similar topics

5
2094
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 suprised, because always think that boost doesn't require any library, it uses templates, doesn't it? Maybe it is program_options error? Please help.
16
2616
by: Jeff Flinn | last post by:
At the risk of raising the OT ire of some here, I'd like to know what might be done to raise the awareness of the boost libraries. I've found boost and it's libraries invaluable in my work for ~5 years now. The first two postings in this group this morning are addressed almost trivially by using libraries from www.boost.org. IMO, the functionality in boost increases the usability of C++ at least as much as the standard library does. ...
1
7791
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~ make.exe -f "D:\temp\Makefile.win" all g++.exe -c main.cpp -o
2
2458
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() ("help", "produce help message") ("input,I", program_options::value<string>(&InputName), "Input md5mesh File") ("out-skl,S", program_options::value<string>(&OutputSkeletonName),
0
402
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: /////////////////////////////////////////////////////////////////// // General options selector template <class T> void CmdLine::GetOption(const std::string& Name, T& var) { if (VariablesMap_.count(Name)) var = VariablesMap_.as<T>();
5
1993
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 compiled :( I'm use: boost 1.32 STLPort 4.6.2 Visual C++ 7.1 WinXP SP2 Prof
1
5386
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; int main(int ac, char* av)
0
1394
by: pallav | last post by:
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.") ;
1
3402
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 = boost::program_options; struct CommandLineParser { CommandLineParser()
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.