I run into some issues because I develop with Visual C++ on Windows, and then also compile on Linux using g++. One thing I ran into that I don't understand is that g++ doesn't seem to be able match data types passed to a function if you pass a reference to the constructor to the function. Specifically, given a method signature like this:
static int to_int(string& value);
If it is called like this:
int id_number = EZXMsg::to_int(string(tokens[index]));
(Where tokens type is a vector<char*>& tokens
)
g++ gives the error:
main.cpp:130: error: no matching function for call to 'ezx::iserver::EZXMsg::to_int(std::string)' ../iserver-api/ezxmsg.h:50: note: candidates are: static int ezx::iserver::EZXMsg::to_int(std::string&)
Visual C++ doesn't have problem compiling this though. To fix it for g++, the code needs to be like this:
string value(tokens[index]);
int roid = EZXMsg::to_int(value);
What is the reason for g++ needing that additional line?