How to pass by ref wxString::Clone() to a function

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

How to pass by ref wxString::Clone() to a function

Post by cutecode »

Code: Select all

int GetGrvIntrTime(wxString &lpsz)
{
	...
}
wxString sz;
p = GetGrvIntrTime(sz.Clone());
This code compiles on Windows, but not on Linux
I got this error message

Code: Select all

error: invalid initialization of non-const reference of type ‘wxString&’ from an rvalue of type ‘wxString’
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to pass by ref wxString::Clone() to a function

Post by DavidHart »

Hi,

Try changing the signature of GetGrvIntrTime() to
GetGrvIntrTime(const wxString &lpsz)

Regards,

David
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: How to pass by ref wxString::Clone() to a function

Post by cutecode »

WOW!!! great, thank you
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
Post Reply