sdatkinson / iPlug2

C++ Audio Plug-in Framework for desktop, mobile and web [PRE-RELEASE]
https://iplug2.github.io
Other
28 stars 4 forks source link

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

Closed ncsolar closed 2 years ago

ncsolar commented 2 years ago

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::vector &, const float &, const bool &, nlohmann::basic_json<>, std::vector &>' requested here return std::make_unique( ^ 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.

ncsolar commented 2 years ago

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.

ncsolar commented 2 years ago

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.

sdatkinson commented 2 years ago

Solved with #9--thanks!