GCC Error "Lack of a suitable function to call .."

I am developing a cross-platform code base where the initial work is done using the MS VC2010 compiler. Later compiles it on Linux with GCC (4.7). In many cases, I get:

"There is no corresponding function to call .." error in GCC. I noticed that he complains mainly when method parameters are not permalinks. For example:

 void MyClass::DoSomeWork(ObjectSP &sprt, const std::string someName, const std::string anotherName, const std::string path, int index) {


        sprt->GetProp()->Update(path, false);

}

As soon as I change the method to this:

 void MyClass::DoSomeWork(const ObjectSP& sprt, const std::string& someName, const std::string& anotherName, const std::string& path, int index) {


        sprt->GetProp()->Update(path, false);

}

GCC stops complaining. Why is this happening and why is this not happening in VC compilers?

+4
source share
1 answer

. , , VS .

, , (, ), g++ , VS . g++ .

const, .

+9

All Articles