# Trouble after iPlug updating. "no suitable user-defined conversion from to exists"

**URL:** <https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398>\
**Category:** Windows\
**Created:** [21 May 2021 18:02 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398 "2021-05-21T18:02:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DSV](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@DSV](https://iplug2.discourse.group/u/DSV)\
**Post date:** [21 May 2021 18:02 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/1 "2021-05-21T18:02:43Z")

</div>

Hi there!  
I use the next kind of construction in my plugin

`auto Midi_Action = [this, pGraphics](IControl* pCaller) {this->Midi_ActionClicked(pCaller); };`

But after updating the iPlug2 I got lots of errors in my project in VS2019. The compiler said:

`Error (active)	E0312	no suitable user-defined conversion from "type" to "std::function" exists	my-app	my.cpp	174`

and so on. All cases when I tried to capture _this_ in a lambda function was underlined as an error.

Then I have rolled back iPlug2 update to one from February and my project started to work correctly.

I’m not sure what happened but trying to update iPlug2 to the latest version have the same results - my project doesn’t compiling in that case.

---

<div class="post-metadata">

**Author:** ![DSV](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@DSV](https://iplug2.discourse.group/u/DSV)\
**Post date:** [21 May 2021 18:24 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/2 "2021-05-21T18:24:21Z")

</div>

It looks I’ve hurried up. The errors E0312 is still here but the project can be compiled. It can be I have had other errors with updated iPlug2 but I didn’t recognise them

---

<div class="post-metadata">

**Author:** ![DSV](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@DSV](https://iplug2.discourse.group/u/DSV)\
**Post date:** [21 May 2021 19:18 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/3 "2021-05-21T19:18:55Z")

</div>

I have revised the project one more time with iPlug2 69f309fd497b9b18cd3dbe6280a73d5815bbce5c [69f309f] (from March, 1st, 2021, 22:36:51) - there is no errors after rebuild. So errors come after iPlug2 updating to the newer version

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [21 May 2021 22:06 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/4 "2021-05-21T22:06:22Z")

</div>

it’s not clear that this is an iPlug2 problem, if you can narrow it down please make a github issue

---

<div class="post-metadata">

**Author:** ![Ric](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Ric](https://iplug2.discourse.group/u/Ric)\
**Post date:** [22 May 2021 03:44 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/5 "2021-05-22T03:44:31Z")

</div>

try capturing like this:

```
auto FunctionName([&, pGraphics](IControl *pCaller)
{
// you can call member functions here without using "this"
}
```

---

<div class="post-metadata">

**Author:** ![DSV](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@DSV](https://iplug2.discourse.group/u/DSV)\
**Post date:** [23 May 2021 20:19 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/6 "2021-05-23T20:19:24Z")

</div>

Thank you! It didn’t help but I know now that the trouble isn’t connected to capturing _this_ in a lambda

Now, when I’ve changed _this_ to _&_, I have errors like this:

```
Error	C2664	'void iplug::igraphics::IGraphics::ForControlInGroup(const char *,std::function<void (iplug::igraphics::IControl *)>)': cannot convert argument 2 from 'my::ProcessSysEx::<lambda_c824d55620e9fc3c8f6d97799d092177>' to 'std::function<void (iplug::igraphics::IControl *)>'

```

this lambda is

```
  this->pGraphics->ForControlInGroup(Tuning, [&](IControl& Control)
      {
        const char* ControlType = typeid(Control).name();
        if (!(strcmp(ControlType, "class TuningTabControl")))
        {
          TuningTabControl* c = static_cast<TuningTabControl*>(&Control);
          c->As<TuningTabControl>()->SetLabelStr(PresetList.GetCurrentPresetCombineName().c_str());

        }
      });

```

The troubles disappeare when I change the folders IPlug and IGraphics to the previous versions (from September, 22, 2020)

---

<div class="post-metadata">

**Author:** ![Ric](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Ric](https://iplug2.discourse.group/u/Ric)\
**Post date:** [23 May 2021 20:40 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/7 "2021-05-23T20:40:44Z")

</div>

Are you sure you didn’t mean to type `(IControl* Control)` instead of `(IControl& Control)` in the lambda function arguments? The error log seems to be complaining about the signature of the function (referred to as “argument 2”).

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [23 May 2021 23:09 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/8 "2021-05-23T23:09:53Z")

</div>

Yep, the signature has changed

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [23 May 2021 23:12 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/9 "2021-05-23T23:12:11Z")

</div>

All IControl lamdas now look like

```
[](IControl* pControl) { … }

```

Before some used a reference not a pointer

---

<div class="post-metadata">

**Author:** ![DSV](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@DSV](https://iplug2.discourse.group/u/DSV)\
**Post date:** [25 May 2021 18:43 UTC](https://iplug2.discourse.group/t/trouble-after-iplug-updating-no-suitable-user-defined-conversion-from-to-exists/398/10 "2021-05-25T18:43:41Z")

</div>

Thank you very much! I’ve corrected some code and now it works correct with the last iPlug2 version
