I’m getting this weird error on VisualStudio 2019 with Juce 7.0.9
juce_ScopedMessageBoxImpl.h, line 78
Error E0289 no instance of constructor "std::shared_ptr<_Ty>::shared_ptr [with _Ty=juce::detail::ConcreteScopedMessageBoxImpl]" matches the argument list
argument types are: (juce::detail::ConcreteScopedMessageBoxImpl *)
Error C2664 'std::shared_ptr<juce::detail::ConcreteScopedMessageBoxImpl>::shared_ptr(std::nullptr_t) noexcept':
cannot convert argument 1 from 'juce::detail::ConcreteScopedMessageBoxImpl *' to 'std::nullptr_t'
Here’s the code (line 78 is the first line in the body):
static std::shared_ptr<ConcreteScopedMessageBoxImpl> runAsync (std::unique_ptr<ScopedMessageBoxInterface>&& p,
std::unique_ptr<ModalComponentManager::Callback>&& c)
{
std::shared_ptr<ConcreteScopedMessageBoxImpl> result (new ConcreteScopedMessageBoxImpl(std::move(p), std::move(c)));
result->self = result;
result->triggerAsyncUpdate();
return result;
}
The project is a dynamic library that doesn’t have a UI. It includes GUI modules merely as a prerequisite for AudioProcessor, which other modules depend on.
Calling make_shared here isn’t guaranteed to work on all platforms because the constructor of ConcreteScopedMessageBoxImpl is private. This is likely why plain new was used here instead.
I’m not sure what’s causing the initial error, but I don’t think the proposed fix is correct. Perhaps it’s worth checking that your Visual Studio install is up-to-date, and that your copy of JUCE doesn’t have any accidental modifications.
There are more compilation issues piling up here with these two classes. Concerning destructors being private (inherited from AsyncAupdater) and member variables being private.
Since it looks like the code hasn’t been reached during testing yet (at least in a DLL project on Windows), it’s probably best to run it through the compiler and fix them as they come up.
In a clean empty Projucer-created DLL project this does not come up. In my project however include_juce_gui_basics.cpp does not compile. I will report back when I found a solution.
Thanks for reporting, this issue should now be fixed:
Thanks for your patience. While this was a (relatively) quick fix, it also wasn’t very high-priority because DLL builds that expose JUCE symbols are not a common use-case. JUCE doesn’t guarantee a stable binary interface, so DLL builds have limited usefulness (you can’t replace an old JUCE DLL with a new one and expect things to ‘just work’). While there may be valid use-cases for a DLL that exposes JUCE functions, I’d normally recommend to follow an approach closer to that of plugin formats. That is, expose a minimal, stable API using only C functions or COM types, keeping all JUCE types and functions completely private.
Actually I’m not exposing any JUCE functions directly. There’s an “extern C” API that does the job. Not sure why the DLL_BUILD option is necessary in the first place.