Juce.dll 2.0 vs2010 win7


#1

I use juce.dll 2.0,do a app,but the complier report :"error C2535: “void *juce::HeapBlock<ElementType,throwOnFailure>::operator new(size_t)”


#2

Are you trying to call “new HeapBlock” somewhere!? I deliberately added the JUCE_PREVENT_HEAP_ALLOCATION to the class to prevent silliness like that.

BTW, if you’re trying to use it as a DLL, you should get the very latest version from GIT, because I added some DLL fixes last week.


#3

:frowning:
I just got the latest viersion of modules.rebuild juce.dll.the app demo is generated by introjucer,i don’t do anything other change.


#4

[quote=“jules”]Are you trying to call “new HeapBlock” somewhere!? I deliberately added the JUCE_PREVENT_HEAP_ALLOCATION to the class to prevent silliness like that.

BTW, if you’re trying to use it as a DLL, you should get the very latest version from GIT, because I added some DLL fixes last week.[/quote]

I didn’t call “new HeapBlock” anywhere,i just got the latest version,but the compiler still report ::error C2535: “void *juce::HeapBlock<ElementType,throwOnFailure>::operator new(size_t)”: redefinition. this trouble In my hair a few days. :frowning:


#5

This is due to newly added macro JUCE_PREVENT_HEAP_ALLOCATION in HeapBlock class template. This macro disallows object creation on heap by declaring new and delete operators in private scope. HeapBlock also has JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, which already defines new and delete operators for windows dll configuration. I guess you can use JUCE_DECLARE_NON_COPYABLE instead of JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR in HeapBlock.


#6

In the latest version it already uses JUCE_DECLARE_NON_COPYABLE.