sdatkinson/iPlug2

No matching constructor for initialization of 'wavenet::WaveNet' macOS 12.4 Apple M1 Xcode 13.4.1

ncsolar opened this issue · 3 comments

I get this error while trying to build VST3 or APP Targets / macOS 12.4 Apple M1 Xcode 13.4.1

No matching constructor for initialization of 'wavenet::WaveNet'

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/unique_ptr.h:728:32: error: no matching constructor for initialization of 'wavenet::WaveNet'
return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/user/Dev/iPlug2/Examples/NAM/get_dsp.cpp:83:17: note: in instantiation of function template specialization 'std::make_unique<wavenet::WaveNet, std::vectorwavenet::LayerArrayParams &, const float &, const bool &, nlohmann::basic_json<>, std::vector &>' requested here
return std::make_uniquewavenet::WaveNet(
^
In file included from /Users/user/Dev/iPlug2/Examples/NAM/get_dsp.cpp:7:
/Users/user/Dev/iPlug2/Examples/NAM/wavenet.h:202:5: note: candidate constructor not viable: expects an lvalue for 4th argument
WaveNet(
^
/Users/user/Dev/iPlug2/Examples/NAM/wavenet.h:200:9: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 5 were provided
class WaveNet : public DSP {
^
/Users/user/Dev/iPlug2/Examples/NAM/wavenet.h:200:9: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 5 were provided
5 warnings and 1 error generated.

I was running out of ideas so I posted a question here: https://stackoverflow.com/questions/73874619/compilation-issue-on-mac-error-no-matching-constructor-for-initialization-of-w

Someone suggested that the code works on Windows and not in Mac due to an extension in MSVC which can bind a rvalue to a non const ref and offered this suggestion "change this line: nlohmann::json& parametric, to take it by const ref instead" This is beyond my c++ knowledge at the moment so I'm hoping someone can try it.

I was able to build the app in Xcode 14.0 macOS 12.6 Apple M1 with the solution proposed here: https://stackoverflow.com/a/73956681/3768284 I also created a pull request.

Solved with #9--thanks!