Headless Juce

Hey people,

I have a linking issue with a newer JUCE build, it says it can’t find some juce::Colour()… It’s a console app and if I add the modules

    juce_gui_basics
    juce_gui_extra

to the project everything works, but I don’t want those modules. I have no gui related classes in my project (and no Colour…), is something linking in the juce base against juce::Colour outside of those gui modules? If so this wasn’t the case some time ago (when headless linux juce support was announced (here)

Friendly regards

equinox

Please can you supply the exact text of the linker error you’re seeing? It would be useful to see which TU is using juce::Colour.

shure, there are like 8 of those in different .obj files:

Main.obj : error LNK2001: unresolved external symbol "public: __cdecl juce::Colour::Colour(unsigned int)" (??0Colour@juce@@QEAA@I@Z)

if I add

juce_gui_basics

everything works finde, but I don’t want this modul (because I think under linux it has some X11 reference?)

is there a list which modules have gui references? e.g. also juce_audio_utils/juce_audio_utils.h has some, which I didn’t expect from it’s name

The Colour constructor is defined in the juce_graphics module. You can work it out which modules depend (or don’t depend) on juce_graphics from the dependencies listed in the main header of each module.

I think that the only modules that don’t depend on juce_graphics are the following:

  • juce_core
  • juce_events
  • juce_data_structures
  • juce_osc
  • juce_cryptography
  • juce_product_unlocking

Some things to try:

  • Remove any modules not mentioned in the list above from your project.
  • Alternatively, add the juce_graphics module to your project. juce_gui_basics depends on juce_graphics, so you could use this module without introducing a dependency on X11.