Page 1 of 1

VST 3.6.11 IDropTarget compile errors on Windows

Posted: Sat Nov 24, 2018 10:56 pm
by squarewave
So, I tried updating to the new VSTGUI version.

IDropTarget has name collision with Win32 OLE struct.
OLE spams its name into global namespace with no sensible restraints (#if block etc)

Normally, one just defines WIN32_MEAN_AND_LEAN to be rid of lots of crud,
but D2D drawing headers include oleidl.h etc, so this doesn't work.

How do you get it to compile on your machines?
To me the simplest is just to rename VSTGUI IDropTarget, it's going to cause grief to more people.

Any advise appreciated.

Thanks,
/rasmus

Re: VST 3.6.11 IDropTarget compile errors on Windows

Posted: Mon Nov 26, 2018 4:17 pm
by Arne Scheffler
This can only happen if you have somewhere "using namespace VSTGUI" in your header.
So remove it.

Cheers,
Arne

Re: VST 3.6.11 IDropTarget compile errors on Windows

Posted: Tue Nov 27, 2018 12:10 am
by squarewave
Ah. Thanks for that. I had it in one place, removing that cleared up my code.

But...

Now these lines would never work in /vstgui/vstgui.h : 68

Code: Select all

#if !defined (VSTGUI_DISABLE_GLOBAL_NAMESPACE_POLLUTION) || VSTGUI_DISABLE_GLOBAL_NAMESPACE_POLLUTION == 0
using namespace VSTGUI;
#endif
So that macro needs to be defined always?

When I define it in my project it seems we need a couple of fixes in aeffguieditor.h/cpp

aeffguieditor.h : 21
class AEffGUIEditor : public AEffEditor, public VSTGUI::VSTGUIEditorInterface

aeffguieditor.h : 59
virtual bool beforeSizeChange (const VSTGUI::CRect& newSize, const VSTGUI::CRect& oldSize);

and the same in aeffguieditor.cpp : 113
int32_t AEffGUIEditor::knobMode = VSTGUI::kCircularMode;

and aeffguieditor.cpp : 204
bool AEffGUIEditor::beforeSizeChange (const VSTGUI::CRect& newSize, const VSTGUI::CRect& oldSize)

Am I missing something else?

=====
EDIT next day:

I managed to compile without the VSTGUI_DISABLE_GLOBAL_NAMESPACE_POLLUTION macro,
while also getting away from the IDropTarget redefinition errors.

This is done by moving
#include <windows.h>

so that it precedes any vstgui header inclusion.
At least in aeffguieditor.cpp as well as any of your own files (your AudioEffectX implementation file for instance)

And you need to
#undef max
#undef min

EDIT next day
(and define UNICODE in preprocessor flags, else aeffguieditor.cpp fails. I probably lost that while fiddling the other flags)
Was in this edit, but it's irrelevant to thread topic, so removed now.

=====

Thanks,
/rasmus

Re: VST 3.6.11 IDropTarget compile errors on Windows

Posted: Wed Nov 28, 2018 5:19 pm
by Arne Scheffler
Hi rasmus,
please checkout the master branch from GitHub (https://github.com/steinbergmedia/vstgui).
It should contain the necessary fixes to get you going and let me know if it works for you.

Cheers,
Arne

Re: VST 3.6.11 IDropTarget compile errors on Windows

Posted: Thu Nov 29, 2018 2:50 am
by squarewave
Ah, I got it working in the end, but much better to have the official.

Thanks for quick fix!

/rasmus