gerfaut | Bonjour,
J'ai essayé cette bibliothèque C++, et je dois dire que c'est assez bien fait. Le seul problème, c'est que je n'arrive pas à compiler l'exemple basique qui est fourni :
Code :
- #include <argstream.h>
- using namespace std;
- int
- main(int argc,char** argv)
- {
- // The variables you want to initialize/set from command line
- bool verbose;
- int level = 1;
- string outputName;
- deque<string> inputNames;
- // Using the argstream to retrieve this information
- argstream as(argc,argv);
-
- as>>option('v',"verbose",verbose,"Activate verbose mode" )
- >>parameter('l',"level",level,"Level of treatment",false)
- >>parameter('o',"out",outputName,"Where to save result" )
- >>values<string>(back_inserter(inputNames),"Files to process" )
- >>help();
-
- as.defaultErrorHandling();
- // Your program
- // ...
- // ...
- // ...
- }
|
Je n'ai aucun problème avec les 'option' et les 'parameter', mais dès que je veux des champs 'values', j'ai des pages d'erreurs de templates qui ne sont pas définis etc...
Est-ce que quelqu'un saurait me dire pourquoi ?
Précision, je compile avec GNU/gcc sous Cygwin.
Voici les erreurs que génère gcc :
argstream.h: In instantiation of `<unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >':
basic_example.cpp:19: instantiated from here
argstream.h:169: error: template-id `operator>><>' for `<unnamed>::argstream& <unnamed>::operator>>(<unnamed>::argstream&, const <unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >& )' does not match any template declaration
argstream.h: In function `<unnamed>::argstream& <unnamed>::operator>>(<unnamed>::argstream&, const <unnamed>::ValuesHolder<T, O>& ) [with T = std::string, O = std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > >]':
basic_example.cpp:20: instantiated from here
argstream.h:177: error: `char <unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >::letter_' is private
argstream.h:743: error: within this context
argstream.h:176: error: `int <unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >::len_' is private
argstream.h:744: error: within this context
argstream.h:176: error: `int <unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >::len_' is private
argstream.h:752: error: within this context
argstream.h:177: error: `char <unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >::letter_' is private
argstream.h:752: error: within this context
basic_example.cpp:20: instantiated from here
argstream.h:176: error: `int <unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >::len_' is private
argstream.h:760: error: within this context
argstream.h:176: error: `int <unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >::len_' is private
argstream.h:760: error: within this context
basic_example.cpp:20: instantiated from here
argstream.h:174: error: `std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > <unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >::value_' is private
argstream.h:765: error: within this context
basic_example.cpp:20: instantiated from here
argstream.h:176: error: `int <unnamed>::ValuesHolder<std::string, std::back_insert_iterator<std::deque<std::string, std::allocator<std::string> > > >::len_' is private
argstream.h:784: error: within this context
|
Pardon pour ce post un peu long. |