us_id=findUser((long)msg.userID); error: invalid cast from type 'String' to type 'long…
- User
us_id=findUser((long)msg.userID); error: invalid cast from type 'String' to type 'long int'
- Assistant
This error occurs because you are trying to cast a string value to a long integer type. In this case, it seems like
msg.userIDis of type string and you are trying to cast it to a long integer type.To resolve this error, you need to convert the string value to a long integer using appropriate conversion functions or methods available in the programming language you are using.
Here is an example using Python:
pythonus_id = findUser(long(msg.userID))In this example, the
long()function is used to convert the string valuemsg.userIDto a long integer.Please note that the exact syntax for converting a string to a long integer may vary depending on the programming language you are using.
- User
String &FB_msg::userID
- Assistant
It seems that
userIDis a member variable of the classFB_msgand its data type isString.In this case, if you want to cast it to a
longtype, you can use appropriate conversion functions or methods provided by the programming language you are using.Here is an example using C++:
cppus_id = findUser(std::stol(msg.userID));In this example,
std::stol()function is used to convert theStringvaluemsg.userIDto alonginteger.Please note that the exact syntax for converting a
Stringto alonginteger may vary depending on the programming language you are using.