Hello,
Recently I've downloaded the DLP-SDK software and tried to compile it in Visual Studio 2017 Community.
I've encountered similar problems to described in thread [DLP-ALC-LIGHTCRAFTER-SDK: Using DLP SDK codes in 64 bit compiler].
I have managed to reach some further point in my attempt to get the software working in VS by using newer version of ASIO and manually setting ASIO_STANDALONE as defined in cmake file (maybe it wasn't that necessary, but works for me).
Anyway, while trying to compile DLP_SDK following errors show up:
C2440 "conversion": cannot convert from "long double" to "T"
C2593 "operator <<'" is ambiguous
Both errors concern finction templates in file "other.hpp". Here are the code parts:
template <typename T> T ToNumber( const std::string &text, unsigned int base = 10){ std::string trimmed = dlp::String::Trim(text); std::size_t hex_0x = trimmed.find("0x"); std::size_t hex_x = trimmed.find("x"); if(hex_0x != std::string::npos){ base = 16; trimmed = trimmed.substr(hex_0x + 2); } else if(hex_x != std::string::npos){ base = 16; trimmed = trimmed.substr(hex_x + 1); } std::istringstream ss(trimmed); T result; long double number; long long number_int; switch(base){ case 8: ss >> std::oct >> number_int; // Convert string to number result = (T) number_int; break; case 16: ss >> std::hex >> number_int; // Convert string to number result = (T) number_int; break; case 10: default: ss >> std::defaultfloat >> number; // Convert string to number result = (T)number; } return result; }
and
template <typename T> std::string ToString( T number ){ std::ostringstream ss; ss << std::setprecision(NUM_TO_STRING_PRECISION); ss << number; return ss.str(); }
This two errors show up in both x86 and x64 projects in Visual Studio 2017. I checked the minGW x86 compilation, it goes without problems. It's strange that MSVC and MinGW behave differently with the same templates.
I'm aware of that the official way of using this software is to compile it with MinGW, but any help would be appreciated - it would be really good to get it working in VS.
Best regards,
Piotr Giza