[C++] Error bij compilen van sigc::mem_fun functieaanroep*

Pagina: 1
Acties:

  • Asperientje
  • Registratie: Juni 2004
  • Laatst online: 07-03-2015
hoi mensen,

ik krijg telkens de volgende foutmelding:

code:
1
2
3
4
5
6
7
8
9
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:251: error: no match
   for call to `(sigc::bound_mem_functor1<void, OptionParser, const
   std::string&>) ()'
/usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:1839: error: candidates are:
   T_return sigc::bound_mem_functor1<T_return, T_obj,
   T_arg1>::operator()(typename sigc::type_trait<T_arg3>::take) const [with
   T_return = void, T_obj = OptionParser, T_arg1 = const std::string&]
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:251: error: return-statement
   with a value, in function declared with a void return type


bij het volgende stuk code:
code:
1
optionParser.insert_flag('o', sigc::mem_fun(&optionParser, &OptionParser::set_config_file));


deze code staat in het volgende geheel: (dit om even een indruk te geven van de correcte functieaanroepen)
code:
1
2
3
4
5
6
7
8
9
10
11
12
 OptionParser optionParser;
  optionParser.insert_flag('h', sigc::ptr_fun(&print_help));
  optionParser.insert_flag('t', sigc::mem_fun(c->get_core(), &core::Manager::debug_tracker));
  optionParser.insert_flag('o', sigc::mem_fun(&optionParser, &OptionParser::set_config_file));

  optionParser.insert_config_flag("bind", sigc::mem_fun(c->get_core(), &core::Manager::set_listen_ip));
  optionParser.insert_config_flag("default_root", sigc::mem_fun(c->get_core(), &core::Manager::set_default_root));
  optionParser.insert_config_flag("dns", sigc::mem_fun(c->get_core(), &core::Manager::set_dns));

  optionParser.insert_config_flag("port_range", sigc::bind(sigc::ptr_fun(OptionParser::call_int_pair),
                                             sigc::mem_fun(c->get_core(), &core::Manager::set_port_range)));
  optionParser.insert_config_flag("download_path", sigc::mem_fun(c->get_core().get_download_store(), &core::DownloadStore::activate));


alle andere aanroepen zijn correct. het probleem is echter dat ik nu de klasse optionparser zelf aanroep, inplaats van een andere klasse. en dan krijg ik steeds deze foutmelding. ik weet helaas alleen niet hoe hem te verhelpen, en heb al redelijk wat dingen geprobeerd... die allemaal door de compiler alleen maar nog fouter gevonden werden :D

ook al gezocht met google, vond wel de functieaanroep en help enzo, maar ik vond geen uitleg over hoe deze fout op te lossen...

ik hoop dat iemand op t forum hier me kan uitleggen wat t wel moet zijn...

Everything's got a meaning


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 15-04 22:07

NMe

Quia Ego Sic Dico.

Titelfix conform *** Over topictitels in P&W - lezen voor topic openen!!! ***. Volgende keer zelf even denken aan het opnemen van de taal. ;)

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


  • MSalters
  • Registratie: Juni 2001
  • Laatst online: 09-04 22:08
Ik vermoed dat OptionParser::set_config_file het verkeerde type heeft.

Man hopes. Genius creates. Ralph Waldo Emerson
Never worry about theory as long as the machinery does what it's supposed to do. R. A. Heinlein


  • Asperientje
  • Registratie: Juni 2004
  • Laatst online: 07-03-2015
dank je

ik heb idd de fout gevonden

ik verw8tte geen argumenten (slotFlag was enkel void) en dus wou ie niet |:(

Everything's got a meaning