954,157 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

error C2664: 'setStartupDirectory' : cannot convert parameter

Hi

I have a virtual function setStartupDirectory()

virtual bool setStartupDirectory(const SysString &sStartupDirectory) = 0;

When I am calling this function
setStartupDirectory((const SysString &)m_pApplicationFolderNarrow);
I am getting this error
Error 2 error C2664: 'setStartupDirectory' : cannot convert parameter 1 from 'const SysString' to 'const SysString &'

Am I missing something

karang
Light Poster
46 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

Here..

virtual void CSample1::Sample(SysString str)
(
   if(str.empty())
      return;
   //...
)
virtual void CSample2::Sample(SysString &str)
{
   str="what's up";
}
int main()
{
   SysString str1="check";
   SysString str2;
   CSample1 s1;
   CSample2 s2;
   s1.Sample(str1);
   s2.Sample(str2);
   return 0; 
}
cikara21
Posting Whiz
340 posts since Jul 2008
Reputation Points: 47
Solved Threads: 69
 

Hi

I have a function
bool setStartupDirectory(const SysString &sStartupDirectory)
{}

Now I want to give the prototype of the function how can I do that

karang
Light Poster
46 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

You can directly make the call to the function as follows

setStartupDirectory(m_pApplicationFolderNarrow);

sweeya
Newbie Poster
8 posts since Nov 2008
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You