std::string tempPath; FileSel file; {...} tempPath = file[i]; <<== error C2593: 'operator =' is ambiguous
tempPath = const_cast<String&>(file[i]);
operator std::string() const;
operator const char *() const { return Begin(); }
Quote: |
C:\MyApps\proto1\main.cpp(42) : error C2872: 'String' : ambiguous symbol could be 'c:\myapps\opencv22\opencv2/core/core.hpp(84) : std::string cv::String' or 'c:\upp\uppsrc\core\String.h(294) : Upp::String' C:\MyApps\proto1\main.cpp(42) : error C2440: 'const_cast' : cannot convert from 'Upp::String' to 'cv::String &' Reason: cannot convert from 'Upp::String *' to 'cv::String *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast |
std::string tempPath; FileSel file; String path; if (file.ExecuteSelectDir()) path = ~file; // Conversion from UPP::String to const tchar * to std::string if (!path.IsVoid()) tempPath = ~path;
std::string tempPath; FileSel file; {...} tempPath = ~file[i]; // converts the Upp::String to const char* //OR tempPath = file[i].Begin(); // basically the same as above //OR tempPath = std::string(~file[i],file[i].GetLength()); // create a new std::string with the same content and length //OR tempPath = std::string(~file[i],file[i].GetLength()); // again, more verbose variation on the previous line
tempFrame = imread( tempPath ); if( findChessboardCorners( tempFrame, checkboardSize, foundCorners )) <<=== Crashes here { frames.push_back( tempFrame ); imagePoints.push_back( foundCorners ); }
#include <CtrlLib/CtrlLib.h> using namespace Upp; GUI_APP_MAIN { FileSel fs; std::string stdPath; if (fs.ExecuteOpen()) { String path = ~fs; PromptOK("From UPP\1::\1String:&\1" + path); stdPath = ~path; PromptOK("From std\1::\1string:&\1" + String(stdPath)); } }