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: 271
Joined: Fri Dec 09, 2016 7:28 am
Contact:

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

Post by cutecode » Mon Jan 06, 2020 12:29 pm

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.4 win/mac/linux

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

DavidHart
Site Admin
Site Admin
Posts: 3925
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 » Mon Jan 06, 2020 1:42 pm

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: 271
Joined: Fri Dec 09, 2016 7:28 am
Contact:

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

Post by cutecode » Mon Jan 06, 2020 2:24 pm

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

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

Post Reply