Windows Linux c++ compiling issue: "no matching function for call" -


i working on tool provides facility write small c++ code within framework provides. tool windows , linux based. write code windows. compilation done first on windows testing purposes. linux build performed run whole production tests on linux.

i created function following signature:

string myclass::myfunc(string& start, bool myflag, class c1 & c1,     long a=0, const char* b=null, void * c=null); 

now when tool runs on windows (microsoft visual express) works fine , tests pass.

however when code compiled on linux error stating "no matching function call".

here function signature:

string myclass::myfunc(string& start, bool myflag, class c1 & c1,     long a=0, const char* b=null, void * c=null); 

error message:

myfile.cpp: no matching function call  myclass::myfunc(std::string, bool, classc1&, long int&,  const char *&, void*&)   myfile.h: note: candidates are:  std::string myclass:myfunc(std::string&, bool&, classc1&,  long int, const char*, void*) 

i not have access linux server. hence cannot mention linux distro or other details.

thanks in advance.

  • ftp

microsoft's c++ compiler incorrectly allows binding non-const references temporary variables. won't fix bug now, because break existing code. code broken on conformant compilers, you've discovered.

see if can't pass value (for small types) or const reference (for ones expensive copy). if it's output argument, you'll need change caller pass lvalue instead of temporary.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -