Anixx
Anixx

Reputation: 139

Call to a function is ambiguious

I am trying to build a program but got an error:

application_ob.cpp: In member function 'void ApplicationWindow::OBNewLoad(QString, QString)':
application_ob.cpp:103:41: error: call of overloaded 'FormatFromExt(QString&)' is ambiguous
application_ob.cpp:103:41: note: candidates are:
/usr/include/openbabel-2.0/openbabel/obconversion.h:81:24: note: static OpenBabel::OBFormat* OpenBabel::OBConversion::FormatFromExt(const char*)
/usr/include/openbabel-2.0/openbabel/obconversion.h:84:24: note: static OpenBabel::OBFormat* OpenBabel::OBConversion::FormatFromExt(std::string)

How can I patch it so to get normal build? Please explain in simple way because I do not know C++.

Upvotes: 0

Views: 176

Answers (1)

Jon
Jon

Reputation: 437336

Line 103 of application_ob.cpp probably reads something like:

FormatFromExt(qs);

The immediate solution would be to change this (or its equivalent) to

FormatFromExt(qs.toStdString());

However, we do not have enough information regarding the possible contents of qs to tell if the above method will work when dealing with non-latin characters. Better alternatives are presented in this answer, but to choose between them we have to know what kind of data we are dealing with.

Upvotes: 2

Related Questions