Bunch of errors when trying to include a juce module

Hi, im new to Juce so its quite difficult for me to solve this on my own.
Im using visual studio 2022 and everything seems fine until i want to include some modules from the JUCE modules directory. Firstly when i browse through the juce modules and look for example at the juce_UnitTest.cpp file it looks like this. Full with errors.

The juce_UnitTest.h file looks fine. No errors there.
However when i try to include the juce_unitest.h file in my project. Like this on the top of my file.

#include <juce_core/unit_tests/juce_UnitTest.h>

Errors are brought over to my project.
And on top of that, the juce_unitest.h file which was fine and without errors before including, is now full with errors after i included it.
What can i do to fix this?

Generally, headers inside modules are not intended to be included directly like this. Instead:

  • Make sure you’ve added the module to your project in the Projucer, then resave.
  • Once the module is included in the project, the module header will automatically be included in JuceHeader.h. If you’re not using JuceHeader.h, you can include the top level header of the module, e.g. #include <juce_core/juce_core.h>, and this will automatically include all of the other headers in the juce_core module.
1 Like

Thanks! There are no errors in my project anymore and i can access unittest now.

1 Like