Hi,
I have given only some part of the code related to my problem. I have problem while compliation. I have the problem in the constructor of the class RMstore. i Get the following compilation error
rmremote_server.cpp: In function `int main()':
rmremote_server.cpp:196: error: no matching function for call to `RMStore::RMStore(std::string)'
rmremote_server.cpp:17: note: candidates are: RMStore::RMStore(const RMStore&)
rmremote_server.cpp:26: note: RMStore::RMStore(std::string&)
class RMStore
{
string command;
string result;
string error;
bool status;
public:
RMStore(string comm = "");
inline string getCommand();
inline string getResult();
bool executeCommand();
};
RMStore::RMStore(string comm):command(comm)
{
result = "";
error = "";
}
string RMServer::getData()
{
return data;
}
int main()
{
string command;
command = "ls -l /usr/local/dataware | grep ^l";
RMServer *server = new RMServer();
if(server->openConn() > 0)
{
while(server->acceptConn() > 0)
{
if(server->recvData() > 0)
{
RMStore *R = new RMStore(server->getData());
//RMStore *R = new RMStore(command);
R->executeCommand();
server->sendData(R->getResult());
//server->sendData(command);
delete R;
}
}
}
}
I was under the impression that, even tough we pass a string, the called function will take it in a ref and the compiler will not complain.
also if i use RMStore *R = new RMStore(command); instead of RMStore *R = new RMStore(server->getData()); i donn get any errors.
am i missing something here? please help?