Build error on audio plugin host


First post…

I downloaded and built JUCE on linux (RHEL 4, 2.6.9-78.0.5.ELsmp). After learning about LUA/premake I got the JUCE demo to build and run, and have successfully built the audio plugins demo under VST_Linux creating the .so file. I don’t have a VST host to run it in though.

I’m trying to build the audio plugins host included under juce/extras/ and get the following error:

juce_amalgamated.cpp:53012: error: `class juce::KeyPress::juce’ has not been declared
juce_amalgamated.cpp:53012: error: expected unqualified-id before ‘)’ token

Line 53012 looks like this:

KeyPress::KeyPress() throw()
: keyCode (0),
mods (0),
textCharacter (0)

I’m guessing somehow the class KeyPress didn’t get declared before the compiler found this code…

I tried searching the forum and google and haven’t come up with any solutions. I’ve previously coded C++ on Linux and Windows, but a little rusty since most of my programming in the last 3 years has been PHP…

Any ideas?


Sounds very odd. It’d be pretty much impossible to avoid including the KeyPress headers, so maybe the problem is a name-clash with some other headers that you’ve included as well?


I started over by re-unziping the files and rebuilding the Debug and Release libraries including VST 2.4 support. Then I went into the juce/extras/audio plugin host/build/linux and edited premake.lua to point to the correct vstsdk directory. Still had the same compile errors on juce_LibrarySource.cpp so I started looking at the source files.

I edited juce/extras/audio plugin/src/juce_LibrarySource.cpp changing

#include "…/…/…/juce_amalgamated.cpp"
#include “…/…/…/juce_amalgamated.h”

and now everything compiles :!: (Don’t really understand why it was including a .cpp file in the first place…)


Including the .cpp is the whole point of the amalgamated version! You include all the code rather than linking to the library


The problem is that KeyPress is defined in some X11 includes. If you look in the VST_Wrapper you can see we are removing X11 keypresses because we include also X11 headers before juce ones:

  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
  #include <X11/Xatom.h>
  #undef KeyPress


Hey guys, I’ve been looking at JUCE on and off for a few months and finally decided to try it for a program I’m planning atm. I’ll be implementing VST hosting so decided to start with the audio plugin host in the extras/ directory.

My main workstation runs Linux (Ubuntu 11.04 i686) and I’ve installed the libraries listed in this post. I downloaded the vstsdk2.4 and have set up my workspace like so:

workspace/libs/vstsdk2.4/ (vst_sdk2_4_rev2) workspace/libs/juce/ (git clone from today)

and updated the Makefile of the audio plugin host example to match the above directory, relative to the Makefile:

$ pwd /home/sherman/workspace/libs/juce/extras/audio plugin host/Builds/Linux/Makefile $ sed -i -e 's@~/SDKs@../../../../..@' Makefile $ grep vst Makefile # output actually appears twice (Debug, Release) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" . . . -I "../../../../../vstsdk2.4" . . . RESFLAGS := -D "LINUX=1" . . . -I "../../../../../vstsdk2.4" . . .

If you try to run make now, it will fail for what looks like the reason shown in this post.

$ make Compiling FilterGraph.cpp Compiling GraphEditorPanel.cpp Compiling HostStartup.cpp Compiling InternalFilters.cpp Compiling MainHostWindow.cpp Compiling JuceLibraryCode1.cpp Compiling JuceLibraryCode2.cpp In file included from ../../JuceLibraryCode/../../../amalgamation/../src/audio/plugin_host/formats/, from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated_template.cpp:216, from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated2.cpp:32, from ../../JuceLibraryCode/JuceLibraryCode2.cpp:15: ../../JuceLibraryCode/../../../amalgamation/../src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp:1914:40: warning: multi-character character constant (above warning repeated a few times on different lines) In file included from ../../../../../vstsdk2.4/pluginterfaces/vst2.x/aeffectx.h:17:0, from ../../JuceLibraryCode/../../../amalgamation/../src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp:105, from ../../JuceLibraryCode/../../../amalgamation/../src/audio/plugin_host/formats/, from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated_template.cpp:216, from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated2.cpp:32, from ../../JuceLibraryCode/JuceLibraryCode2.cpp:15: ../../../../../vstsdk2.4/pluginterfaces/vst2.x/aeffect.h:125:32: error: expected ‘)’ before ‘*’ token (above error repeated a few times on different lines) ../../../../../vstsdk2.4/pluginterfaces/vst2.x/aeffect.h:149:2: error: ‘AEffectDispatcherProc’ does not name a type (above error repeated a few times with the other types from the VSTCALLBACK typedefs in the same file)
with some additional errors following, due to the above.

The post mentioned above shows some changes to juce_VST_Wrapper.cpp, but this file isn’t referenced in the audio plugin host project, so __cdecl is never defined (that I can find). If I modify juce_VSTPluginFormat.cpp as shown:

[code]$ cat src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp
#include “…/…/…/core/juce_TargetPlatform.h”
#include “…/…/…/…/juce_Config.h”


#undef _WIN32_WINNT
#define _WIN32_WINNT 0x500
#undef STRICT
#define STRICT 1
#include <windows.h>
#include <float.h>
#pragma warning (disable : 4312 4355)
#pragma warning (disable : 1899)
#define __cdecl // <- Added define here
#include <float.h>
#include <sys/time.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#undef Font
#undef KeyPress
#undef Drawable
#undef Time
#define Point CarbonDummyPointName // (workaround to avoid definition of “Point” by old Carbon headers)
#include <Cocoa/Cocoa.h>
#include <Carbon/Carbon.h>
#undef Point

#include “…/…/…/core/juce_StandardHeader.h”

#if ! (JUCE_MAC && JUCE_64BIT)


I can compile further and get the following errors:

$ make Compiling FilterGraph.cpp Compiling GraphEditorPanel.cpp Compiling HostStartup.cpp Compiling InternalFilters.cpp Compiling MainHostWindow.cpp Compiling JuceLibraryCode1.cpp Compiling JuceLibraryCode2.cpp In file included from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated_template.cpp:359:0, from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated2.cpp:32, from ../../JuceLibraryCode/JuceLibraryCode2.cpp:15: ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/drawables/juce_Drawable.cpp:43:1: error: ‘juce’ in class ‘juce::Drawable’ does not name a type ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/drawables/juce_Drawable.cpp:49:12: error: expected class-name before ‘::’ token ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/drawables/juce_Drawable.cpp:49:12: error: expected constructor, destructor, or type conversion before ‘::’ token In file included from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated_template.cpp:369:0, from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated2.cpp:32, from ../../JuceLibraryCode/JuceLibraryCode2.cpp:15: ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:211:1: error: ‘juce’ in class ‘juce::Font’ does not name a type ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:216:1: error: ‘juce’ in class ‘juce::Font’ does not name a type ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:221:1: error: ‘juce’ in class ‘juce::Font’ does not name a type ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:226:1: error: ‘juce’ in class ‘juce::Font’ does not name a type ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:231:1: error: ‘juce’ in class ‘juce::Font’ does not name a type ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:242:8: error: expected class-name before ‘::’ token ../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:242:8: error: expected constructor, destructor, or type conversion before ‘::’ token make: *** [build/intermediate/Debug/JuceLibraryCode2_683aaa00.o] Error 1

Finally, I modified juce_VSTPluginFormat.cpp again and commented out the lines that redefine Drawable, Font, etc… :

[code] $ cat src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp
#include <pluginterfaces/vst2.x/aeffectx.h>

#pragma warning (pop)

// #define Font JUCE_NAMESPACE::Font
// #define KeyPress JUCE_NAMESPACE::KeyPress
// #define Drawable JUCE_NAMESPACE::Drawable
// #define Time JUCE_NAMESPACE::Time

#include “…/juce_PluginDescription.h”[/code]

Now if I run make, the build succeeds as expected.

Jules, sorry for the wall of text. I started writing this as I went and well, it turned more into my rambling notes to help me keep track. I’m still quite new to the codebase and was hoping to find my feet with the extras/ examples, so I have no idea if the above will break something else. From the thread I linked, it looks like you’ve encountered these issues elsewhere, and found fixes within the affected code. Could you confirm this change or provide more information on a possible fix? I haven’t really looked at the git repo yet, do you accept user submitted fixes or should I use the bug tracker on the sourceforge page in future?

Wow, so now that’s all over…

Hi, I’m new to the boards but have been lurking for a few weeks. I’m working on a performance-based sequencer and host and am eager to see how well juce can handle some of the heavy lifting so I can focus on the features and fun stuff :slight_smile: I’m a software engineer and tester by day (c/c++ security middleware :S ), and techno/*step/uk-bass DJ and producer by night (and music software developer now too, it seems). I use a macbook at home and linux (my main OS) on my work/dev laptop, so my app will run on those (plus windows if I can find someone who wants to build/test on it). I’m sure I’ll be spending some time in the mac/linux/audio parts of the forum, so see you all then.



Linux VST hosting is one of the very very few bits of code that I rely on other people’s contributions for… So hopefully someone who knows that side of things will be able to help you out here!


Ok, no worries. Like I said, everything looks ok for now. If it all comes crashing down, I’ll provide more info.


i had problems building the audio plugin host. thanks for your howto on making it work. unfortunately the program segfaults on startup. did you make any additional changes? gcc and clang builds both produced this:

schmiedl@satellite:~/ports/juce/extras/audio plugin host/Builds/Linux/build$ ./Plugin\ Host 
JUCE v1.53.107
ALSA device: hw:Intel,0 outs=2-2 ins=2-2 rates=3
Segmentation fault
schmiedl@satellite:~/ports/juce/extras/audio plugin host/Builds/Linux/build$ gdb Plugin\ Host 
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /home/schmiedl/ports/juce/extras/audio plugin host/Builds/Linux/build/Plugin Host...done.
(gdb) run
Starting program: /home/schmiedl/ports/juce/extras/audio plugin host/Builds/Linux/build/Plugin Host 
[Thread debugging using libthread_db enabled]
JUCE v1.53.107
ALSA device: hw:Intel,0 outs=2-2 ins=2-2 rates=3
[New Thread 0x7ffff1319700 (LWP 8443)]

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()

thanks in advance,


Please don't report bugs in old versions of the code! Unless you can show the problem still exists in the latest version, you're wasting everyone's time!

Please don’t report bugs in old versions of the code! Unless you can show the problem still exists in the latest version, you’re wasting everyone’s time!



I got the same first problem as Sherman with the __cdecl stuff, which I fixed by opening the audio plugin host introjucer project and adding a precompiler flag “-D__cdecl=”.
But then I have a different problem:

Compiling juce_audio_processors.cpp
In file included from ../../../../modules/juce_audio_processors/juce_audio_processors.cpp:68:0:
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:2021:41: warning: multi-character character constant [-Wmultichar]
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:235:8: error: ‘Display’ does not name a type
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:236:8: error: ‘XContext’ does not name a type
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:238:31: error: typedef ‘juce::EventProcPtr’ is initialized (use decltype instead)
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:238:31: error: ‘XEvent’ was not declared in this scope

It looks like Xlib.h is not included, so I added it to the top of juce_VSTPluginFormat.cpp. But then the declarations of some types in Xlib.h such as Time, conflict with the Juce ones. I presume there is some tuning to do in the “amalagamation” file juce_audio_processors/juce_audio_processors.cpp so that Xlib related code is parsed before juce’s own types are declared, but I don’t master this part of Juce enough to find what to do exactly.

Any ideas? Jules? Linux gurus?


I’ve been doing quite a bit of juce/linux lately and would be willing to at least take a look. Is there a reasonable Linux VST container for testing?


Well, I get these errors when I try to to compile juce’s “audio plugin host” which you can find in the extras/ directory of the git repository. I’m using the latest tip, on ubuntu 11.10. You also need the vstsdk2.4 headers and that’s all.
Other extras such as the introjucer compile with no problem. The problem seems to be with the vst hosting code (or, more likely, include order).


I get that you’re having a build problem. I’m in embedded ARM hell today, but will try to look at it tomorrow. I was asking about a good container because I don’t know how else to test the resulting build once the dependencies, etc. are squared away.


I don’t really understand what you mean by “container” but it’s probably a problem with my level of English.
I think once you get the audio plugin host demo to build, I can try to find or compile a linux VST to test it. There’s no hurry though. But if I’m having these problems, I guess other people do as well, as I’ve not been doing anything fancy here.


I should have been clearer, I was distracted the last couple of days helping dig out some crashing problems on someone’s product. Now that earth shattering discoveries like “if you do not service the watch dog timer, your device will reset” are behind me, I’ll give building this a shot tonight.

What I meant was ‘is there an alternate working plug-in host?’ It seems that folks are having trouble both building plug-ins and the host on linux. I was going to go one end to the other. Build a simple plug-in, test it with another host (container), then build the juce host (container). Anyway, I’ll take a look tonight after work and see how far I get.


I did a little tweaking to address a bunch of namespace collisions, but didn’t get very far. I have to sheepishly admit that it took me forever to get the SDK downloaded from Steinberg last night. I had the same trouble navigating their site that I have trying to work “iDrive” in my wife’s BMW. Apparently I just don’t get how German’s think… But I’ll take another stab at it after work.


Hello everyone… I recently got started with Juce for VST development, and I have run into the same issues when compiling the Juce (edit) audio plugin host. I have tried compilation with the VST SDK 3.0 and 2.4. Both result in the same errors as previously mentioned.

That said, while being very comfortable with Linux, my C++ is rustier than a garden shovel. The compiler output might look like something to someone, but it doesn’t look like much to me at this point. Any guidance would be spectacular. I can post the compiler output if necessary.


I managed to fix the compilation on juce tip (after fixing the prerequisite first).

I used the -D__cdecl= flag stated above, aside with the following changes:

diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
index 16b6be0..9e529b5 100644
--- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
+++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
@@ -62,13 +62,6 @@
- #define Font       juce::Font
- #define KeyPress   juce::KeyPress
- #define Drawable   juce::Drawable
- #define Time       juce::Time
 #include "juce_VSTMidiEventList.h"
@@ -335,6 +328,11 @@ namespace
+ #undef KeyPress
+ #define KeyPress   juce::KeyPress
 class ModuleHandle    : public ReferenceCountedObject
diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp
index fdf43b7..a6e9d72 100644
--- a/modules/juce_audio_processors/juce_audio_processors.cpp
+++ b/modules/juce_audio_processors/juce_audio_processors.cpp
@@ -54,6 +54,7 @@
  #include <X11/Xlib.h>
+ #include <X11/Xutil.h>

Still getting a warning though:

../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:2043:38: warning: multi-character character constant [-Wmultichar]

but it doesn’t sound too violent.
Note that it compiles but I have no idea if it works yet :oops:
Hope this helps.


Thanks! I’ll certainly add the extra include, but am a little confused about why you removed that set of defines from higher up in the file?

Perhaps if they’re not needed, all of those defines should be removed, and instead just change the one use of “KeyPress” to be fully qualified, at line 1204:

bool keyPressed (const juce::KeyPress&)