I can’t reproduce this, i never installed gcc lower then 4.7 on the laptop i have, and i saw this error and i remember replacing “zerostruct” with the code that’s inside this function.
But i have a different problem, i created a brand new VST plugin project and wanted to compile it in codeblocks, 3 issues came up
the VST sdk path is not added to the include paths of the project
in the debug configuration the -g flag is not turned on (no debugging symbols are created)
This error shows up:
[ 45.8%] mingw32-g++.exe -Wno-strict-aliasing -Wno-strict-overflow -march=pentium4 -O0 -std=gnu++0x -D__MINGW__=1 -D__MINGW_EXTENSION= -DJUCER_CODEBLOCKS_20734A5D=1 -I. -I..\..\JuceLibraryCode -Ic:\devel\vstsdk2.4 -IC:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST -c C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp -o obj\Debug\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.o
C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:66:0: warning: "__cdecl" redefined [enabled by default]
C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:1:0: note: this is the location of the previous definition
C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:287:29: warning: multi-character character constant [-Wmultichar]
In file included from C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:78:0:
c:\devel\vstsdk2.4/public.sdk/source/vst2.x/audioeffectx.cpp: In member function 'virtual void AudioEffectX::resume()':
c:\devel\vstsdk2.4/public.sdk/source/vst2.x/audioeffectx.cpp:307:69: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp: In function 'LRESULT {anonymous}::mouseWheelHookCallback(int, WPARAM, LPARAM)':
C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:174:19: error: 'MOUSEHOOKSTRUCTEX' does not name a type
C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:176:93: error: 'hs' was not declared in this scope
C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp: At global scope:
C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:1553:43: warning: first argument of 'int main(audioMasterCallback)' should be 'int' [-Wmain]
C:\devel\Morf\JuceLibraryCode\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:1553:43: warning: 'int main(audioMasterCallback)' takes only zero or two arguments [-Wmain]
Process terminated with status 1 (0 minute(s), 13 second(s))
2 error(s), 5 warning(s) (0 minute(s), 13 second(s))
Maybe you’re using some kind of 3rd party header that’s #defining a symbol and messing up the build?
Re: building VSTs in CodeBlocks, if you want to find a way to get it going and let me know what you needed to do, that’d be awesome, but it’s too low-priority for me to look at it myself.
C:\devel\JUCE\modules\juce_audio_processors\format_types/juce_VSTPluginFormat.cpp: In member function 'virtual void juce::VSTPluginWindow::paint(juce::Graphics&)':
C:\devel\JUCE\modules\juce_audio_processors\format_types/juce_VSTPluginFormat.cpp:2053:66: error: 'class juce::ComponentPeer' has no member named 'getScreenPosition'
Process terminated with status 1 (0 minute(s), 1 second(s))
1 error(s), 19 warning(s) (0 minute(s), 1 second(s))
Now i tried a bit of a hacky way and just commented out the offending line
It compiled fine, the Plugin Host demo got build, then a Hello World Plugin got build and i was able to load the DLL in the Audio Plugin Host. So it works i just don’t know why that method is not visible in that file.
It could be declared at the start of the cpp file inside an #if JUCE_MINGW. Could you try it and suggest some code that compiles? I don’t have time to put together a codeblocks plugin project myself.
At line 2052 comment out (i don’t know why this fails, i also don’t know what will happen on other platforms if you comment this out, it seems to work)
I’ve also been fiddling around with building VSTs in CodeBlocks.
One issue I have noticed, that is easy to fix, is that the CodeBlocks project the Introjucer makes is set up to build a GUI application rather than a dynamic library.
I have another problem as well which I have no idea why exists. I have created a simple gain plugin project in the Introjucer to test a few things. Just one parameter controlling gain and no editor.
At first my processBlock looked like this:
Nice and simple. This works fine when I build in Visual Studio. But the plugin causes the host to crash if I build in CodeBlocks.
Changing it to something like this:
[code]const int numSamples = buffer.getNumSamples();
for (int channel = 0; channel < getNumInputChannels(); ++channel)
{
float* channelData = buffer.getSampleData (channel);
for (int i = 0; i < numSamples; ++i)
{
channelData[i] *= gain;
}
}[/code]
Everything seems to work fine when building in CodeBlocks.
The change you made to juce_VST_Wrapper.cpp causes a problem
C:\devel\JUCE\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp: In function 'LRESULT {anonymous}::mouseWheelHookCallback(int, WPARAM, LPARAM)':
C:\devel\JUCE\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:184:96: error: 'const struct MOUSEHOOKSTRUCTEX' has no member named 'pt'
C:\devel\JUCE\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:184:105: error: 'const struct MOUSEHOOKSTRUCTEX' has no member named 'pt'
C:\devel\JUCE\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:187:72: error: 'const struct MOUSEHOOKSTRUCTEX' has no member named 'pt'
C:\devel\JUCE\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp:187:93: error: 'const struct MOUSEHOOKSTRUCTEX' has no member named 'pt'
C:\devel\JUCE\modules\juce_audio_plugin_client\VST\juce_VST_Wrapper.cpp: At global scope:
I think that you need to inherit from other structures so you can see all members of it
When compiling with GCC on windows, i can’t get the DLL path inside the plugin it always returns the host path. When i use the MS compiler with codeblocks, it works (i have both installed, MS compiler is just faster, they’re both free and i can’t install visual studio cause i don’t have admin privileges on my workstation).
Also i can’t debug using CDB or GDB when compiling with GCC, i know this isn’t JUCE related, but maybe someone has an idea on how to debug VST plugins with GCC/GDB, GDB does not load new symbols when a VST is loaded in the host (i use the Plugin Host from the extras dir). I don’t see the debug output (anything that comes from Logger::writeToLog) in the debugger console, i re-compiled the Plugin Host with debugging enabled, that didn’t help. I thought that the host should be built without debugging symbols and just the plugins should have the debugging symbols so they don’t cause problems. I can load additional symbols to gdb using “symbols-file” command but when i do that the host doesn’t start with Memory I/O errors. Anyone knows how to deal with that ?
If possible could Introjucer not use compiler flags but IDE specific flags. For example Codeblocks knows how to enable debug symbols on almost all compilers, but if you add “-g” it will fail with MS compiler. The same goes for all other flags that introjucer adds to the generated project.
As far as I am aware this is a problem with CodeBlocks itself. Even if you create a project solely within CodeBlocks changing the compiler will mess up all the flags.
I think you could possibly add a new build target to the CodeBlocks project which uses the compiler you want. Having the Introjucer create CodeBlocks projects which have a target for each compiler seems a bit silly to me though.
Well no Introjucer should no export project for ALL compilers, i don’t event think that Introjucer should have an option to choose a compiler. But the codeblocks projects are compiler independent, i switch between GCC and MSVC all the time, i’ve seen no real problems with that. Event if it is problematic Introjucer is export a Codeblocks project not a GCC project, so it should use Codeblocks flags not GCC flags just as it does for XCode and MSVC.
Having said that, now that i look at the .cbp file i don’t think it’s possible, it specifies compiler specific flags inside the file, so the IDE just adds/removes those flags whenever you pick the compiler.
Forget it then it makes no sense to implement this, it’s Codeblocks that’s doing this all wrong.