home Forums # Technical Support Can not convert scalar to unary

This topic contains 2 replies, has 2 voices, and was last updated by  asho 2 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
• Author
Posts
• #961

asho
Participant

Hi
Thank you for your very interesting library.

I am trying to use Fuzzylite in C#. Using CMake a VS C++ version is created and I resolved a few error messages, but these are remained.

========================= CODE ===================================================================
scalar BoundedSum::compute(scalar a, scalar b) const {
return Op::min(1.0, a + b);
}
—————————- ERROR Message ——————————————————————
error C2782: ‘T fl::Operation::min(T,T)’ : template parameter ‘T’ is ambiguous

================================ CODE ============================================================
this->operators[“~”] = new Operator(“~”, fl::Op::negate, p, 1);

———————– Error ——————————————————————
cannot convert argument 2 from ‘fl::scalar (__cdecl *)(fl::scalar)’ to ‘fl::Function::Unary’

What is the best way to resolve those.

#962

Juan Rada-Vilela
Keymaster

Hi,

Can you use fuzzylite in C#? What kind of changes did you have to make to compile for C#?

As for the errors, could you try this:

For first error:

scalar BoundedSum::compute(scalar a, scalar b) const {
return Op::min(scalar(1.0), a + b);
}

For second error:

this->operators["~"] = new Operator("~", &(fl::Op::negate), p, 1);

Cheers.

#1003

asho
Participant

Hi Juan

Thank you, I guess I missed your reply. I tried to port the code to C# with a converter and manual changes. It takes much time specifically due to C# limited schema of compiler instructions (e.g. #Define) comparing to C++. I can send you the code, if you want to check it or if you can give me clues how to quickly prepare it.

Also I tried using TIBIMP utility in .Net that produces a a runtime callable wrapper (.Net compatible library) from COM Dlls. But it raises an error and mentiones that this is not a valid type library (error TI1002). I wonder if you can build a dll with type library embedded or a COM compatible dll. So every .Net programmer can easily create a a runtime callable wrapper (RCW) of fuzzylite and use it.

Best Regards

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.