• Resolved

DLP-ALC-LIGHTCRAFTER-SDK: DLP-ALC-LIGHTCRAFTER-SDK

Prodigy 40 points

Replies: 7

Views: 243

Part Number: DLP-ALC-LIGHTCRAFTER-SDK

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

  • Hello Piotr,

    First, welcome to the DLP section of the TI-E2E forums.

    I have let the software team know about this issue.  They should engage with you on this.

  • In reply to Fizix:

    Hello Piotr,

    Can you tell us which chipset you are wanting to use this with?

    Fizix

  • In reply to Fizix:

    Hello Fizix,

    that's the decision I haven't made yet. For now I'm just trying to meet the requierement for being able to use the code in Visual Studio (either in x86 or x64 form). That's the IDE we use in our project, so I can't avoid it.

    It seemed to be almost done, but the compiler complains about those two templates parts:

    result = (T)number; (cannot convert long double to T)

    ss << number; (operator << is ambiguous)

    Best regards,

    Piotr

  • In reply to Piotr Giza:

    Hello Piotr,

    Sorry for the delay on this.  I have been working with our software team on this.  Did you resolve the issue.  If so let us know.

    Fizix

  • In reply to Fizix:

    Hello Fizix,

    I haven't resolved this issue yet. According to chipset question: the equipment we already have is Lightcrafter 3000. But that's not really important by now, since we would be considering switching to some other hardware.

    Best regards,

    Piotr

  • In reply to Piotr Giza:

    hi All,

    I met the same issue when I convert to VS2015.

    I think that the root cause is c++11 cannot support float to string by “<<” operator.

    I made a quick change as below.

    In Other.hpp,

    template <typename T>
    std::string ToString( T number ){
    std::ostringstream ss;
    ss << std::setprecision(NUM_TO_STRING_PRECISION);
    //ss << number;
    ss << (unsigned int)number;
    return ss.str();
    }

    template <> std::string ToString<std::string>( std::string string );
    template <> std::string ToString<char>( char number );
    template <> std::string ToString<unsigned char>( unsigned char number );
    template <> std::string ToString<float>( float number );
    }

    In other.cpp , add a template for "float"

    template <> std::string Number::ToString<float>( float number ){
    std::ostringstream ss;
    ss << number;
    return ss.str();
    }

    BR,

    Frank

  • In reply to Frank(DLP) Liu:

    Hi all,

    yeah, Frank, this solution made the job. Thank you very much!

    I can now confirm that the x64 compilation in Visual Studio 2017 Community was successfull.

    For those who will probably struggle with it in the future - here are some other changes I made before it went good:

    disable hidapi build and linking in cmake - I've built the x64 version of hidapi sperately from github source (only hidapi library compiled normally, but that seems to be enough) and added it manually to project,

    use fresh version of Asio instead of the provided one,

    sometimes cmake mess up some paths in project options - for example a bug can show up that file "C:/Program" is not available. Quick look in options, the path was split according to spaces that were present in it (this may concern more lightcrafter apps than sdk itself).

    I cannot say that all this was absolutely necessary since I've made many things to get this working. Neither did I tested everything, but the DLP LightCrafter 3D Scan Application compiles and works in VS x64.

    Best regards,

    Piotr