First time back in a while. New project won't compile fresh out of the projucer

I’ve put this in the Linux section since I’m running Ubuntu 20.04, but feel free to move this if it belongs somewhere else. I hit a wall a while back teaching myself via the tutorials and some youtube videos, and now I’m trying to dive back in. Unfortunately, I can’t even get a basic project to compile; maybe someone here can help with what might be an easy/obvious fix for someone who knows what they’re doing?

I got the most recent version of the projucer, started a new plugin project, named it “Monotonicizer”, set the exporter to CodeBlocks, and then saved the project. Next I opened that project in CodeBlocks and hit compile. I get an error:

error: ‘Monotonicizer’ was not declared in this scope

beneath that, it says

note: in expansion of macro ‘JucePlugin_Name’

which takes me to line 34, which is the return statement in this function in the PluginProcessor.cpp file:

const juce::String MonotonicizerAudioProcessor::getName() const
{
return JucePlugin_Name;
}

Should the project not compile fresh out of the Projucer? Have I configured something wrong?

Thanks for any help!

The JucePlugin_Name macro is usually defined like

#define JucePlugin_Name "MyPlugin"

in “JucePluginDefines.h” in the JuceLibraryCode folder. That error message makes it sound like somehow the plugin name is not being quoted properly. What does the definition of JucePlugin_Name look like?

Thanks very much for the reply. In the JucePluginDefines.h file in the JuceLibraryCode folder for that project, I have the lines:

#ifndef JucePlugin_Name
#define JucePlugin_Name “Monotonicizer”
#endif

Sounds like that’s what’s expected?

Yeah, everything looks right there. Not sure what the issue might be, then!

FWIW I just created a default plug-in project with the same name on MacOS, that looks identical to the code snippets you’ve posted here, and it builds without issue.

I wonder if it’s an issue related to CodeBlocks or its exporter – you might try adding a Makefile exporter and see if the project will build using make?

Thanks again for the reply, sorry that I didn’t think to try that right away. Compiling via the Makefile completed successfully. Is it likely I’ve misconfigured something in CodeBlocks somewhere along the way? Could this be an issue with how the Projucer generates the CodeBlocks project? Should I take this to CodeBlocks forums?

Thanks again for any help.

No worries – that’s what the forum’s here for! I doubt it’s an issue with your exporter configuration, unless of course you’ve redefined JucePlugin_Name somewhere, but that seems doubtful…

I’m not sure if it’s an issue with the Projucer CodeBlocks generator, or if it’s an issue with CodeBlocks itself. To make sure that the quotes are in fact the source of the error, could you try adding this macro to your code:

#define STRINGIFY(x) #x

const juce::String MonotonicizerAudioProcessor::getName() const
{
    return STRINGIFY (JucePlugin_Name);
}

If missing quotes are indeed the issue, this workaround should cause the CodeBlocks build to succeed. Not really a solution, but should at least verify the cause of the issue.

Thanks for raising this. It looks like the Projucer CodeBlocks generator wasn’t escaping some plugin definitions properly. This patch should fix the issue:

To use this, you’ll need to checkout the latest develop, rebuild the Projucer, then use this new Projucer to resave your project.

Hello. I Am having a similar problem. I extracted the latest Juce Zip (6.0.5) on Ubuntu 20.04. Ran Projucer and set up the global paths.
Then I tried to build a “basic” plugin and opened it in Codeblocks and get the same error as Jlmoriart

Then I downloaded the patch. Inside that folder was no projucer but a set of doc/example/extras/modules folders.

So then I restarted my original projucer and set new global paths to these new folders. Is this correct or have I missed something?

Anyway I get the same error from codeblocks when I try to build :frowning:

Would appreciate any help.

Thanks

The fix mentioned above has been pushed to the develop branch of the juce repository. Instead of downloading a zip, better clone the juce repository from GitHub - juce-framework/JUCE: JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, LV2 and AAX audio plug-ins. via git to your machine and check out the develop branch. This way you always get access to the latest fixes and additions – and using version control not only for JUCE but for your personal projects is a thing I would recommend anyway.

OK I dont even know how to do that but ill look into it, thanks. So if I clone the develop branch it will update on its own? or do I have to run an update on it?

you do not have to update it. cloning a repository copies the latest versions of all the files. you will need to build the projucer, but otherwise it is ready to go. at a later date if you want to make sure you have the latest code, you will execute the git pull command from anywhere in the JUCE folder hierarchy. for consistency sake, you should rebuild the projucer whenever you pull new code.

Thanks. Im trying to build the Projucer using the makefile in the development branch (via cd to folder and “make” in terminal) but its giving me a shared library, not an executable. Sorry im not used to linux yet and I might be doing something stupid here. Is this the correct method?