I’ve followed this tutorial to update my Hello World-esque gain VST from using the now deprecated ScopedPointer to std::uniqe_ptr However, I’ve got a silly error that I can’t seem to figure out for my first big hurdle as a learner.
I’ve narrowed it down to the following line
mGainValue =
std::make_unique<AudioProcessorValueTreeState::SliderAttachment>
(new AudioProcessorValueTreeState::SliderAttachment(p.getAPVTS(), "gain", mGainSlider));
The error is here
Severity Code Description Project File Line Suppression State
Error C2664 ‘juce::AudioProcessorValueTreeState::SliderAttachment::SliderAttachment(const juce::AudioProcessorValueTreeState::SliderAttachment &)’: cannot convert argument 1 from ‘_Ty’ to ‘const juce::AudioProcessorValueTreeState::SliderAttachment &’ Hard Gainer_SharedCode C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\memory 2064
While I understand that there is a type mismatch, I don’t understand why I am receiving it or how to proceed. The guides I have seen do not have different code. So, please, if anyone could shed some light on how I’m being an idiot, I’d be most appreciative.
Thanks for the reply. However, removing the new keyword hasn’t fixed the error. It has been five days now that I have been stuck with this error and I cannot see how to resolve it. Do you have any idea what may be causing this issue?
@ilikesupernoodles we can’t help you without knowing more about your code. Which exact version of JUCE are you using? What is the type of mGainValue? Does p.getAPVTS() return an AudioProcessorValueTreeState& as expected?
The error that you shared in your first post is also incomplete. It mentions _Ty, but it doesn’t say what _Ty is.
I can assure you that was the complete error, copy/pasted straight from Visual Studio’s output.
I haven’t changed any code since removing the new keyword, but the errors that appear on a clean build are now different. C2280 and C2248. All I have done since is close Projucer/Visual Studio and reboot my workstation.
Severity Code Description Project File Line Suppression State
Error C2280 'juce::AudioProcessorValueTreeState::SliderAttachment::SliderAttachment(const juce::AudioProcessorValueTreeState::SliderAttachment &)': attempting to reference a deleted function (compiling source file ..\..\Source\PluginEditor.cpp) Hard Gainer_SharedCode C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\memory 2064
and
Severity Code Description Project File Line Suppression State
Error C2248 'juce::AudioProcessorValueTreeState::SliderAttachment::SliderAttachment': cannot access private member declared in class 'juce::AudioProcessorValueTreeState::SliderAttachment' (compiling source file ..\..\Source\PluginEditor.cpp) Hard Gainer_SharedCode C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\memory 2063
Double clicking either error takes me to this function inside a file called “Memory”
// FUNCTION TEMPLATE make_unique
template <class _Ty, class... _Types, enable_if_t<!is_array_v<_Ty>, int> = 0>
_NODISCARD unique_ptr<_Ty> make_unique(_Types&&... _Args) { // make a unique_ptr
return unique_ptr<_Ty>(new _Ty(_STD forward<_Types>(_Args)...));
}
If there is any other information I can provide that will help, let me know.
What you copy-pasted comes from the “Error List” view of Visual Studio, which contains a single line per error/warning. In the “Output” view (after making sure that it reads Show output from: Build in the top-left corner), you usually have more details about the error/warning. Please provide errors/warnings with all details.
Could you please copy-paste your current version of the code that fails to compile? Maybe you didn’t apply @Xenakios’ suggestion properly.
There is a 99% chance it is not the same issue, so please put all your information here or preferrably in a new thread. You may use the questions asked here to compile your posting:
What do you want to achieve?
What does your code look like? The line of error plus context, i.e. declaration of the involved variables