I need to have a nested pass by reference.
EDITED TO INCLUDE ACTUAL CODE
Exact error is:
no matching function for call to ‘CLItem::getValue(std::string*&)’
Complete error is:
App/CycCmdLine.cpp: In member function ‘std::string CycCmdLine::getEnvironment()’:
App/CycCmdLine.cpp:245: error: no matching function for call to ‘CycCmdLine::getValue(const char [16], std::string&)’
./../CmdLine/CmdLine.h: In member function ‘bool CmdLine::getValue(std::string, T&) [with T = std::string*]’:
App/CycCmdLine.cpp:384: instantiated from here
./../CmdLine/CmdLine.h:237: error: no matching function for call to ‘CLItem::getValue(std::string*&)’
./../CmdLine/CmdLine.h:145: note: candidates are: bool CLItem::getValue(bool&)
./../CmdLine/CmdLine.h:146: note: bool CLItem::getValue(std::string&)
./../CmdLine/CmdLine.h:147: note: bool CLItem::getValue(long unsigned int&)
./../CmdLine/CmdLine.h:148: note: bool CLItem::getValue(std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)
./../CmdLine/CmdLine.h:149: note: bool CLItem::getValue(std::list<std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&)
Updated code:
// initial caller
string CycCmdLine::getEnvironment()
{
string sRet="";
do
{
if(hasLogFile())
{
string sLogFile="";
getValue(CYCCMD_CMDSTR_LOGFILE, sLogFile);
sRet+="\n -Profiler logfile: "+sLogFile;
}
}while(false);
return(sRet);
}
// CmdLine::getValue function definition (this is in the header file, as a template should be)
template <typename T>
bool CmdLine::getValue(string sName, T &tValue)
{
bool bRet=false;
do
{
// try to get the iterator
bool bExists;
map<string, CLItem*>::iterator itItr;
bExists=getMapElement(sName, itItr);
// go ahead and return the value
if(!itItr->second->getValue(tValue)) { break; }
bRet=true;
}while(false);
return(bRet);
}
bool CLItem::getValue(string& sValue)
{
bool bRet=false;
do
{
// is this the correct type?
if(!isType(CLType_STRING)) { break; }
// return the value
sValue=m_sValue;
bRet=true;
}while(false);
return(bRet);
}
If we look into this part of the message
It seems to say that at
App/CycCmdLine.cpp:384you call getValue withTbeing astd::string*. This then causes the template to try to call a function that doesn’t exist.Start investigating this line 384!