943,701 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 655
  • C++ RSS
Dec 5th, 2008
0

error C2664: 'setStartupDirectory' : cannot convert parameter

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Light Poster
karang is offline Offline
46 posts
since Jul 2008
Dec 5th, 2008
0

Re: error C2664: 'setStartupDirectory' : cannot convert parameter

Here..
c++ Syntax (Toggle Plain Text)
  1. virtual void CSample1::Sample(SysString str)
  2. (
  3. if(str.empty())
  4. return;
  5. //...
  6. )
  7. virtual void CSample2::Sample(SysString &str)
  8. {
  9. str="what's up";
  10. }
  11. int main()
  12. {
  13. SysString str1="check";
  14. SysString str2;
  15. CSample1 s1;
  16. CSample2 s2;
  17. s1.Sample(str1);
  18. s2.Sample(str2);
  19. return 0;
  20. }
Last edited by cikara21; Dec 5th, 2008 at 3:26 am.
Reputation Points: 47
Solved Threads: 69
Posting Whiz
cikara21 is offline Offline
340 posts
since Jul 2008
Dec 5th, 2008
0

Re: error C2664: 'setStartupDirectory' : cannot convert parameter

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
Reputation Points: 10
Solved Threads: 0
Light Poster
karang is offline Offline
46 posts
since Jul 2008
Dec 5th, 2008
0

Re: error C2664: 'setStartupDirectory' : cannot convert parameter

You can directly make the call to the function as follows

setStartupDirectory(m_pApplicationFolderNarrow);
Last edited by sweeya; Dec 5th, 2008 at 5:14 am.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
sweeya is offline Offline
8 posts
since Nov 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Can someone help me.
Next Thread in C++ Forum Timeline: Not repeated elements in link list (help)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC