I am making a simple multithreaded server program in C ++, the fact is that I use libconfig ++ to parse configuration files. Well, libconfig does not support multithreading, so I use two wrapper classes to do "support". Point, one of them fails:
class app_config {
friend class app_config_lock;
public:
app_config(char *file) :
cfg(new libconfig::Config()),
mutex(new boost::mutex())
{
cfg->readFile(file);
}
private:
boost::shared_ptr<libconfig::Config> cfg;
boost::shared_ptr<boost::mutex> mutex;
};
Failure to call from main.cpp file:
app_main::app_main(int c, char **v) : argc(c), argv(v) {
try {
config = app_config("mscs.cfg");
} catch (libconfig::ParseException &e) {
cout << "Parse error at line " << e.getLine() << ": " << e.getError() << endl;
throw;
} catch (libconfig::FileIOException &e) {
cout << "Configuration file not found." << endl;
throw;
}
}
And he says:
main.cpp: In constructor βapp_main::app_main(int, char**)β:
main.cpp:38:54: error: no matching function for call to βapp_config::app_config()β
main.cpp:38:54: note: candidates are:
../include/app_config.h:15:5: note: app_config::app_config(char*)
../include/app_config.h:15:5: note: candidate expects 1 argument, 0 provided
../include/app_config.h:12:7: note: app_config::app_config(const app_config&)
../include/app_config.h:12:7: note: candidate expects 1 argument, 0 provided
main.cpp:41:39: warning: deprecated conversion from string constant to βchar*β [-Wwrite-strings] (THIS CAN BE IGNORED, I WAS USING STD::STRING, YET CHANGED IT FOR TESTING PURPOSES)
Which is strange, because I explicitly pass the argument, and, in addition, its a char *!.
Well, as always, any help would be appreciated.
Julian.
source
share