I’m currently facing an issue where my .cpp files in the JUCE framework are not recognizing the corresponding .h header files. This has caused compilation errors and prevented me from progressing with my project. I’ve tried various troubleshooting steps, including checking file paths, ensuring proper header inclusions, and updating the JUCE framework. However, the problem persists.
Here’s a summary of the issue:
When I attempt to compile my .cpp files, I receive compilation errors similar to "undefined reference to function name" or "no matching function for call to function name."
These errors are specifically related to functions or variables defined in the corresponding .h header files.
I've also updated the JUCE framework to the latest version.
I’m seeking assistance from experienced JUCE developers to identify the cause of this issue and provide a solution. Any insights or suggestions would be greatly appreciated.
A clone of the JUCE repo, or a .zip file unpacked into some path on your local machine somewhere?
What is meant by the term “JUCE framework [is] not recognizing the corresponding .h header files”? - that your compiler cannot find the JUCE headers, or is Projucer complaining about the Global JUCE Module path you’ve set in your project?
This is a fairly common problem and usually relates to the answer to one of the above questions not quite being correct, technically …
Hi,
I am using Projucer + VS 22.
There is no actuall error message since I canť access the “not implemented code”.
Everytime I open a .cpp file it just has many errors. What has helped was writing: #include JucerHeader.h and the errors dissaper.
For example:
class SaturationPlugin : public juce::AudioProcessor
{
Are you opening your project in VS2022, or just individual .cpp files?
Because the expectation that VS2022 knows about your project (i.e. where to find header files to include) if you are not opening the project, but rather just .cpp files, is incorrect.
How are you opening your project - from with Projucer, or independently using the VS2022 File|Open dialog?
I am making a plugin. I am using a clone of the JUCE repo using FORK. I guess the problem is with the modules and the compiler. Projucer isn´t complaining at all.
Okay then, something else is going wrong … how about you go through @daniel’s common mistakes list and double check you have things set up as expected?
don’t modify the juce files. If they were broken, we would know
don’t put #pragma once in cpp files
Those curly red lines in juce code is intellisense getting confused. That is an unfortunate issue the juce team is aware of but don’t know an easy way to fix it.
I see from the screenshot that you have added a VST SDK path. Do you try to build VST2 (legacy)? That needs extra checks, but if you want to make current VST, then it is VST3 and you don’t need to set anything. Best to clear that setting from projucer, just in case.
In the Projucer open the modules tab and select the modules one by one. There are too many ways to specify the location of the modules:
either set “Use global path” and it will use the path from your screenshot above
or set that off and make sure the path above is legit
Hope any of those things help. Otherwise we can continue there
All of my modules use the global path. So I think that can’t be the problem. I have tried to test some plugins and even they didnt work. I am going to reinstall my JUCE files because there is no way its something else. I am also thinking about cmake you mentioned earlier. Would downloading an earlier version of VS or JUCE help with my problem?
There is no need to switch to cmake, both ways should work for you.
VS is unlikely, in juce there is the chance you accidentally modified something while poking.
What would be crucial to make sure you are using the same Projucer version like the modules you are trying to build. Originally it was meant to only matter on major versions, but it can be flakey especially on the develop branch.
What others here would help to help is a screenshot of the actual error. It becomes a bit guesswork here.
This sounds really similar to a problem I’ve had with Visual Studio over the years, which is that Intellisense sometimes can’t see the Juce header. I think it’s because some of those header files don’t get build until compile time, and Intellisense isn’t smart enough to run all of the necessary macros before the code has been compiled for the first time. If you’re having the same issue as me, then it’s possible that Visual Studio will actually be able to compile the code just fine, and that the Juce related Intellisense errors will start to disappear once you’ve compiled it for the first time.
I assume that you’ve tried compiling it already and that it won’t run. In that case, it’s possible that there are other errors besides the reported Juce ones that are stopping it from compiling, and that once you solve those, the program will compile correctly. So look for errors that are not related to missing Juce classes and try to fix those. (This can be a pain because you probably have hundreds or thousands of errors, and you’ll have to go through the whole thing).