I have a function here that compiles perfectly with VC++ 2013. It's function is to return a string whose whitespaces have been removed. I understand there are alternatives to go about this method, but I'm not interested in "isspace" or whatever.
This does the job on my Windows machine. However, on a UNIX server with g++, I get the following error:
1 2 3 4
error: in passing argument 1 of ‘const string& RemoveWhitespace(std::string&)’
externconst std::string & RemoveWhitespace(std::string &inputStr);
^
file.cpp:87:123: error: invalid initialization of non-const reference of type ‘std::string& {aka std::basic_string<char>&}’ from an rvalue of type ‘std::basic_string<char>’