Introjucer project not building (newbie Q!)

I’ve used Introjucer to create a project “JucePlay” under Linux, selecting my modules from a local JUCE GIT repo (as of yesterday) and configuring “Local JUCE folder” to point to it. All other Introjucer settings as default. But it doesn’t build:

Compiling MainComponent.cpp
In file included from ../../Source/MainComponent.h:12:0,
                 from ../../Source/MainComponent.cpp:9:
../../Source/../JuceLibraryCode/JuceHeader.h:21:18: error: ‘juce’ is not a namespace-name
../../Source/../JuceLibraryCode/JuceHeader.h:21:22: error: expected namespace-name before ‘;’ token
In file included from ../../Source/MainComponent.cpp:9:0:
../../Source/MainComponent.h:21:1: error: expected class-name before ‘{’ token
../../Source/MainComponent.h:27:17: error: ‘Graphics’ has not been declared
../../Source/MainComponent.h:32:71: error: ISO C++ forbids declaration of ‘JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR’ with no type [-fpermissive]
../../Source/MainComponent.h:32:71: error: expected ‘;’ at end of member declaration
../../Source/MainComponent.cpp: In constructor ‘MainContentComponent::MainContentComponent()’:
../../Source/MainComponent.cpp:15:22: error: ‘setSize’ was not declared in this scope
../../Source/MainComponent.cpp: At global scope:
../../Source/MainComponent.cpp:22:35: error: variable or field ‘paint’ declared void
../../Source/MainComponent.cpp:22:35: error: ‘Graphics’ was not declared in this scope
../../Source/MainComponent.cpp:22:45: error: ‘g’ was not declared in this scope
make: *** [build/intermediate/Debug/MainComponent_a6ffb4a5.o] Error 1

The generated Makefile doesn’t have any reference to my JUCE GIT repo or the modules within it and AppConfig.h is empty. I’m sure I could dive in to the Makefile and fix it but that would mean abandoning Introjucer which doesn’t seem right or desirable.

I’m sure this is newbie finger trouble but I can’t find the key bit of config / documentation to get me over this hurdle!

Directory layout (as exists under ~/workspace) attached. Jucer config and Makefile below.

Thanks in advance!

<?xml version="1.0" encoding="UTF-8"?>

<JUCERPROJECT id="oSJazw" name="JucePlay" projectType="guiapp" version="1.0.0"
              bundleIdentifier="com.yourcompany.JucePlay" jucerVersion="3.1.0">
  <MAINGROUP id="TJE0ql" name="JucePlay">
    <GROUP id="{25948AE8-1E0C-BA16-2DDC-7E4016A37F05}" name="Source">
      <FILE id="oB5Bpo" name="MainComponent.cpp" compile="1" resource="0"
      <FILE id="teWPFI" name="MainComponent.h" compile="0" resource="0" file="Source/MainComponent.h"/>
      <FILE id="F53Zu4" name="Main.cpp" compile="1" resource="0" file="Source/Main.cpp"/>
    <MODULE id="juce_core" showAllCode="1" useLocalCopy="0"/>
    <MODULE id="juce_events" showAllCode="1" useLocalCopy="0"/>
    <MODULE id="juce_graphics" showAllCode="1" useLocalCopy="0"/>
    <MODULE id="juce_data_structures" showAllCode="1" useLocalCopy="0"/>
    <MODULE id="juce_gui_basics" showAllCode="1" useLocalCopy="0"/>
    <MODULE id="juce_gui_extra" showAllCode="1" useLocalCopy="0"/>
    <MODULE id="juce_gui_audio" showAllCode="1" useLocalCopy="1"/>
    <MODULE id="juce_opengl" showAllCode="1" useLocalCopy="0"/>
    <LINUX_MAKE targetFolder="Builds/Linux" juceFolder="~/workspace/JUCE/modules">
        <CONFIGURATION name="Debug" libraryPath="/usr/X11R6/lib/" isDebug="1" optimisation="1"
        <CONFIGURATION name="Release" libraryPath="/usr/X11R6/lib/" isDebug="0" optimisation="3"
# Automatically generated makefile, created by the Introjucer
# Don't edit this file! Your changes will be overwritten when you re-save the Introjucer project!

ifndef CONFIG

ifeq ($(CONFIG),Debug)
  BINDIR := build
  LIBDIR := build
  OBJDIR := build/intermediate/Debug
  OUTDIR := build

  ifeq ($(TARGET_ARCH),)
    TARGET_ARCH := -march=native

  CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode
  CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0
  LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ 
  RESFLAGS :=  -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode
  TARGET := JucePlay

ifeq ($(CONFIG),Release)
  BINDIR := build
  LIBDIR := build
  OBJDIR := build/intermediate/Release
  OUTDIR := build

  ifeq ($(TARGET_ARCH),)
    TARGET_ARCH := -march=native

  CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode
  LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) -fvisibility=hidden -L/usr/X11R6/lib/ 
  RESFLAGS :=  -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode
  TARGET := JucePlay

# (this disables dependency generation if multiple architectures are set)
DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)

  $(OBJDIR)/MainComponent_a6ffb4a5.o \
  $(OBJDIR)/Main_90ebc5c2.o \

.PHONY: clean

	@echo Linking JucePlay
	-@mkdir -p $(BINDIR)
	-@mkdir -p $(LIBDIR)
	-@mkdir -p $(OUTDIR)

	@echo Cleaning JucePlay
	-@rm -f $(OUTDIR)/$(TARGET)
	-@rm -rf $(OBJDIR)/*
	-@rm -rf $(OBJDIR)

	@echo Stripping JucePlay
	-@strip --strip-unneeded $(OUTDIR)/$(TARGET)

$(OBJDIR)/MainComponent_a6ffb4a5.o: ../../Source/MainComponent.cpp
	-@mkdir -p $(OBJDIR)
	@echo "Compiling MainComponent.cpp"
	@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"

$(OBJDIR)/Main_90ebc5c2.o: ../../Source/Main.cpp
	-@mkdir -p $(OBJDIR)
	@echo "Compiling Main.cpp"
	@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"

-include $(OBJECTS:%.o=%.d)

Strange… it looks like your directories are set up correctly, but if AppConfig.h is empty, that kind of implies that it couldn’t find any modules. Not sure what’s going on there! What did it generate inside JuceHeader.h ?



    IMPORTANT! This file is auto-generated each time you save your
    project - if you alter its contents, your changes may be overwritten!

    This is the header file that your files should include in order to get all the
    JUCE library headers. You should avoid including the JUCE headers directly in
    your own source files, because that wouldn't pick up the correct configuration
    options for your app.



#include "AppConfig.h"

 // If your code uses a lot of JUCE classes, then this will obviously save you
 // a lot of typing, but can be disabled by setting DONT_SET_USING_JUCE_NAMESPACE.
 using namespace juce;

namespace ProjectInfo
    const char* const  projectName    = "JucePlay";
    const char* const  versionString  = "1.0.0";
    const int          versionNumber  = 0x10000;



And AppConfig.h is completely empty? Not even a comment? That’s bizarre - I can’t see a code-path that could fail like that without at least giving you an error message…

To say it’s empty was wrong, apologies for the confusion. But there’s not a lot in it!


    IMPORTANT! This file is auto-generated each time you save your
    project - if you alter its contents, your changes may be overwritten!

    There's a section below where you can add your own custom code safely, and the
    Introjucer will preserve the contents of that block, but the best way to change
    any of these definitions is by using the Introjucer's project settings.

    Any commented-out settings will assume their default values.




// (You can add your own code in this section, and the Introjucer will not overwrite it)




Have you made sure that each export target (i.e. Linux Makefile) has the “Local JUCE folder” property set correctly? I usually find this is the problem if the AppConfig.h file isn’t being generated correctly. I think in your case it should contain “…/…/JUCE/modules”.

I thought that if this path isn’t a valid modules directory the Introjucer uses the global modules location but I can’t remember exactly.

That’s got it! It seems using “~” for my home directory was the problem. “~/workspace/JUCE/modules” doesn’t work but the relative path you suggested or “/home/user/workspace/JUCE/modules” does work.

It now builds and runs.

Thanks for the excellent and responsive support!

Hmm. Surprising that “~” didn’t work.