Home > Back-end >  Vs2019 error very quantity reference initial value must be an lvalue
Vs2019 error very quantity reference initial value must be an lvalue

Time:03-22

Severity code shows the project file line prohibits display status
Error C2664 "STD: : string VideoCompositor: : getShowTime (STD: : string & amp; 1 cannot be the parameter, int) ": from" STD: : string "into" STD: : string & amp;"

CodePudding user response:

Means you have to build a string variable that receives the results of your getStartTime, then use this variable when parameter to call getShowTime

CodePudding user response:

On the other hand, you want to call, then in getShowTime code change over there, or not reference, or front const reference

CodePudding user response:

Method requires a string reference as a parameter
String STR (videoObject getStartTime ());
GetShowTime (STR);

CodePudding user response:

Reference that is itself
If a parameter is a reference, so that the incoming variables of itself, if the variable is a temporary variable that is to say he is the right value, and the right values cannot be changed,
With the following code
Has the following function
Void fun (int & amp; A) {
A=3;
}
Int ret () {
Return 10;
}
int b;
Fun (b);//this sentence after the execution is 3 b
If this is so call?
Fun (3);
Or
Fun (ret ());//execution after the change of is who??????
  • Related