# juce\_data\_structures.cpp does not compile for DLL build

**URL:** <https://forum.juce.com/t/juce-data-structures-cpp-does-not-compile-for-dll-build/11571>\
**Category:** Windows\
**Created:** [September 29, 2013, 6:32pm UTC](https://forum.juce.com/t/juce-data-structures-cpp-does-not-compile-for-dll-build/11571 "2013-09-29T18:32:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ans](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ans/32/617_2.png) [@ans](https://forum.juce.com/u/ans)\
**Post date:** [September 29, 2013, 6:32pm UTC](https://forum.juce.com/t/juce-data-structures-cpp-does-not-compile-for-dll-build/11571/1 "2013-09-29T18:32:16Z")

</div>

With Juce 2.1.3,&nbsp;I'm currently puzzled as to why **juce\_data\_structures.cpp** , **juce\_events.cpp** and **juce\_gui\_basics.cpp** refuse to compile with JUCE\_DLL\_BUILD=1 (VC 2010 project also inherits \_WINDLL and \_MBCS), while everything is fine for much similar EXE builds.&nbsp;

This last worked without problems with Juce 2.0.32, so the projects should be configured properly.

The errors are related to **ContainerDeletePolicy** , with the following error variants being reported:

C2248: "juce::ValueTree::SharedObject": can not access private class declared in juce::ValueTree  
C2248: "juce::PopupMenu::HelperClasses": can not access private struct declared in &nbsp;juce::PopupMenu  
C2248: "juce::MultiTimer::MultiTimerCallback": can not access private struct declared in juce::MultiTimer

(not sure if my translation of the MSVC message to English is correct)

What really bugs me is how this could depend on DLL or not.

Needless to say this blocks everything currently.

Any idea how to fix this?  
Thanks in advance!  
&nbsp;

---

<div class="post-metadata">

**Author:** ![ans](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ans/32/617_2.png) [@ans](https://forum.juce.com/u/ans)\
**Post date:** [September 30, 2013, 8:14am UTC](https://forum.juce.com/t/juce-data-structures-cpp-does-not-compile-for-dll-build/11571/2 "2013-09-30T08:14:38Z")

</div>

After diving into the adventure&nbsp;of understanding compiler quirks, I finally found a solution.

Jules, you are a genious. You already implemented the&nbsp; **JUCE\_PUBLIC\_IN\_DLL\_BUILD** &nbsp;macro which comes in handy here.  
​These are the fixes:

In file&nbsp;juce\_ValueTree.h:

```
private:
    //==============================================================================
    JUCE_PUBLIC_IN_DLL_BUILD (class SharedObject)
    friend class SharedObject;

    ReferenceCountedObjectPtr<SharedObject> object;
    ListenerList<Listener> listeners;
    ...
```

In file juce\_PopupMenu.h:

```
private:
    //==============================================================================
    JUCE_PUBLIC_IN_DLL_BUILD (class Item)
    JUCE_PUBLIC_IN_DLL_BUILD (struct HelperClasses)
    JUCE_PUBLIC_IN_DLL_BUILD (friend struct HelperClasses)
    JUCE_PUBLIC_IN_DLL_BUILD (friend class MenuBarComponent)

    OwnedArray<Item> items;
    LookAndFeel* lookAndFeel;
    ...
```

&nbsp;

In file juce\_juce\_MultiTimer.h:

```
private:
    JUCE_PUBLIC_IN_DLL_BUILD (struct MultiTimerCallback)
    SpinLock timerListLock;
    ...
```

Still puzzled why this would be necessary in the first place, but happy it works again.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 30, 2013, 8:24am UTC](https://forum.juce.com/t/juce-data-structures-cpp-does-not-compile-for-dll-build/11571/3 "2013-09-30T08:24:37Z")

</div>

Ok, thanks for the heads-up, I'll add that. (But surely no need to wrap the 'friend' declarations in the macro too??)

&nbsp;

---

<div class="post-metadata">

**Author:** ![ans](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ans/32/617_2.png) [@ans](https://forum.juce.com/u/ans)\
**Post date:** [September 30, 2013, 4:46pm UTC](https://forum.juce.com/t/juce-data-structures-cpp-does-not-compile-for-dll-build/11571/4 "2013-09-30T16:46:25Z")

</div>

> But surely no need to wrap the 'friend' declarations in the macro too?

Oh, that was just to make sure all potential cases are covered and move on. I have no doubt you will know better.
