Having a bit of trouble getting my app running


#1

I am not using introjucer, but have included all the modules in my include file. I am very new to JUCE and would be very grateful for any help. 

Thanks in advance. I have included the details below.

 

Compiler: g++ (GCC) 4.8.2

Software  OS X 10.9.1 (13B42)

Processor  2.66 GHz Intel Core i7

 

My Makefile:


#
# TODO: Move `libmongoclient.a` to /usr/local/lib so this can work on production servers
#
CC := g++ # This is the main compiler
SDL = -framework SDL2
# CC := clang --analyze # and comment out the linker last line for sanity
SRCDIR := src
BUILDDIR := build
TARGET := bin/ChronoGraffMonitor
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
CFLAGS := -g -Wall -Wcpp -static-libstdc++ -std=c++0x -mmacosx-version-min=10.7
# -L /usr/local/Qt-5.3.0/lib
# -I /usr/local/Qt-5.3.0/include
LIB := -pthread -L /usr/local/Cellar/sdl2/2.0.3/lib -lmongoclient -L lib -lboost_thread-mt -lboost_filesystem-mt -lboost_system-mt -lboost_chrono-mt
INC := -I include -I /usr/local/Cellar/sdl2/2.0.3/include -I lib
$(TARGET): $(OBJECTS)
    @echo " Linking..."
    @echo " $(CC) $^ -o $(TARGET) $(LIB)"; $(CC) $^ -o $(TARGET) $(SDL) $(LIB)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
    @mkdir -p $(BUILDDIR)
    @echo " $(CC) $(LDFLAGS) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $<
clean:
    @echo " Cleaning...";
    @echo " $(RM) -r $(BUILDDIR) $(TARGET)"; $(RM) -r $(BUILDDIR) $(TARGET)
# Tests
tester:
    $(CC) $(LDFLAGS) $(CFLAGS) test/tester.cpp $(INC) $(LIB) -o bin/tester
# Spikes
ticket:
    $(CC) $(LDFLAGS) $(CFLAGS) spikes/ticket.cpp $(INC) $(LIB) -o bin/ticket
.PHONY: clean

My main.cpp:


// JUCE
#include "juce/JuceHeader.h"
#include <memory>
#include <iostream>
#include <exception>
#include <string>
#include <stdio.h>
// Boost
#include <boost/array.hpp>
#include <boost/asio.hpp>
// Mongo
#include "clients/mongo/all.h"
// GUI
//#include "views/gui/sdl/all.h"
#include "views/gui/juce/all.h"
// Worklog
#include "models/worklog.h"
class ChronoGraffApplication : public juce::JUCEApplication
{
public:
    ChronoGraffApplication() { }
    const juce::String getApplicationName() override { return ProjectInfo::projectName; }
    const juce::String getApplicationVersion() override { return ProjectInfo::versionString; }
    bool moreThanOneInstanceAllowed() override { return true; }
    // ===============================================================
    // Initialise the application
    void initialise (const juce::String& commandLine) override
    {
        MongoFactory mf;
        std::unique_ptr<Mongo> mongo = mf.createMongo();
        mainWindow = new MainWindow;
    }
    void shutdown() override
    {
        mainWindow = nullptr;
    }
    void systemRequestedQuit() override
    {
        quit();
    }
    void anotherInstanceStarted (const juce::String& commandLine) override
    {
    }
    // ========================================================================
    /*
        The MainWindow class implements the desktop window that contains an
        instance of the views/gui/juce/ChronoGraff class.
    */
    class MainWindow : public juce::DocumentWindow
    {
    public:
        MainWindow() : juce::DocumentWindow("Chrono Graff Activity Monitor", juce::Colours::lightgrey, juce::DocumentWindow::allButtons)
        {
            setContentOwned (new ChronoGraff(), true);
            centreWithSize (getWidth(), getHeight());
            setVisible (true);
        }
        void closeButtonPressed()
        {
            juce::JUCEApplication::getInstance()->systemRequestedQuit();
        }
    private:
        DISALLOW_COPY_AND_ASSIGN (MainWindow);
    };
private:
    juce::ScopedPointer<MainWindow> mainWindow;
};
START_JUCE_APPLICATION (ChronoGraffApplication);

And the error when building:


g++   -g -Wall -Wcpp -static-libstdc++ -std=c++0x -mmacosx-version-min=10.7 -I include -I /usr/local/Cellar/sdl2/2.0.3/include -I lib -c -o build/chrono_graff.o src/chrono_graff.cpp
 g++   -g -Wall -Wcpp -static-libstdc++ -std=c++0x -mmacosx-version-min=10.7 -I include -I /usr/local/Cellar/sdl2/2.0.3/include -I lib -c -o build/chrono_timer.o src/chrono_timer.cpp
 g++   -g -Wall -Wcpp -static-libstdc++ -std=c++0x -mmacosx-version-min=10.7 -I include -I /usr/local/Cellar/sdl2/2.0.3/include -I lib -c -o build/main.o src/main.cpp
 g++   -g -Wall -Wcpp -static-libstdc++ -std=c++0x -mmacosx-version-min=10.7 -I include -I /usr/local/Cellar/sdl2/2.0.3/include -I lib -c -o build/mongo.o src/mongo.cpp
 g++   -g -Wall -Wcpp -static-libstdc++ -std=c++0x -mmacosx-version-min=10.7 -I include -I /usr/local/Cellar/sdl2/2.0.3/include -I lib -c -o build/sdl_handle.o src/sdl_handle.cpp
 g++   -g -Wall -Wcpp -static-libstdc++ -std=c++0x -mmacosx-version-min=10.7 -I include -I /usr/local/Cellar/sdl2/2.0.3/include -I lib -c -o build/worklog.o src/worklog.cpp
 Linking...
 g++  build/chrono_graff.o build/chrono_timer.o build/main.o build/mongo.o build/sdl_handle.o build/worklog.o -o bin/ChronoGraffMonitor -pthread -L /usr/local/Cellar/sdl2/2.0.3/lib -lmongoclient -L lib -lboost_thread-mt -lboost_filesystem-mt -lboost_system-mt -lboost_chrono-mt
Undefined symbols for architecture x86_64:
  "juce::DocumentWindow::mouseDoubleClick(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::getBorderThickness()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::lookAndFeelChanged()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::maximiseButtonPressed()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::minimiseButtonPressed()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::parentHierarchyChanged()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::userTriedToCloseWindow()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::activeWindowStatusChanged()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::getContentComponentBorder()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::paint(juce::Graphics&)", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::resized()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::setName(juce::String const&)", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::DocumentWindow::DocumentWindow(juce::String const&, juce::Colour, int, bool)", referenced from:
      ChronoGraffApplication::MainWindow::MainWindow() in main.o
  "juce::DocumentWindow::~DocumentWindow()", referenced from:
      ChronoGraffApplication::MainWindow::MainWindow() in main.o
      ChronoGraffApplication::MainWindow::~MainWindow() in main.o
  "juce::TopLevelWindow::addToDesktop(int, void*)", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::TopLevelWindow::focusOfChildComponentChanged(juce::Component::FocusChangeType)", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::JUCEApplication::getInstance()", referenced from:
      ChronoGraffApplication::MainWindow::closeButtonPressed()       in main.o
  "juce::JUCEApplication::initialiseApp()", referenced from:
      vtable for ChronoGraffApplication in main.o
  "juce::JUCEApplication::getAllCommands(juce::Array<int, juce::DummyCriticalSection, 0>&)", referenced from:
      vtable for ChronoGraffApplication in main.o
  "juce::JUCEApplication::getCommandInfo(int, juce::ApplicationCommandInfo&)", referenced from:
      vtable for ChronoGraffApplication in main.o
  "juce::JUCEApplication::unhandledException(std::exception const*, juce::String const&, int)", referenced from:
      vtable for ChronoGraffApplication in main.o
  "juce::JUCEApplication::getNextCommandTarget()", referenced from:
      vtable for ChronoGraffApplication in main.o
  "juce::JUCEApplication::perform(juce::ApplicationCommandTarget::InvocationInfo const&)", referenced from:
      vtable for ChronoGraffApplication in main.o
  "juce::JUCEApplication::resumed()", referenced from:
      vtable for ChronoGraffApplication in main.o
  "juce::JUCEApplication::suspended()", referenced from:
      vtable for ChronoGraffApplication in main.o
  "juce::JUCEApplication::JUCEApplication()", referenced from:
      ChronoGraffApplication::ChronoGraffApplication() in main.o
  "juce::JUCEApplication::~JUCEApplication()", referenced from:
      ChronoGraffApplication::ChronoGraffApplication() in main.o
      ChronoGraffApplication::~ChronoGraffApplication() in main.o
  "juce::ResizableWindow::setContentOwned(juce::Component*, bool)", referenced from:
      ChronoGraffApplication::MainWindow::MainWindow() in main.o
  "juce::ResizableWindow::parentSizeChanged()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::ResizableWindow::visibilityChanged()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::ResizableWindow::childBoundsChanged(juce::Component*)", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::ResizableWindow::moved()", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::ResizableWindow::mouseDown(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::ResizableWindow::mouseDrag(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::JUCEApplicationBase::createInstance", referenced from:
      _main in main.o
  "juce::JUCEApplicationBase::main(int, char const**)", referenced from:
      _main in main.o
  "juce::JUCEApplicationBase::quit()", referenced from:
      ChronoGraffApplication::systemRequestedQuit()       in main.o
  "juce::Font::Font(float, int)", referenced from:
      ChronoGraff::paint(juce::Graphics&)       in chrono_graff.o
  "juce::Font::~Font()", referenced from:
      ChronoGraff::paint(juce::Graphics&)       in chrono_graff.o
  "juce::Colour::Colour(juce::Colour const&)", referenced from:
      ChronoGraff::paint(juce::Graphics&)       in chrono_graff.o
      ChronoGraffApplication::MainWindow::MainWindow() in main.o
  "juce::Colour::Colour(unsigned int)", referenced from:
      ChronoGraff::paint(juce::Graphics&)       in chrono_graff.o
  "juce::Colour::~Colour()", referenced from:
      ChronoGraff::paint(juce::Graphics&)       in chrono_graff.o
      ChronoGraffApplication::MainWindow::MainWindow() in main.o
  "juce::String::String(char const*)", referenced from:
      ChronoGraffApplication::ChronoGraffApplication() in main.o
      ChronoGraffApplication::getApplicationName()       in main.o
      ChronoGraffApplication::getApplicationVersion()       in main.o
      ChronoGraffApplication::MainWindow::MainWindow() in main.o
  "juce::String::~String()", referenced from:
      ChronoGraffApplication::ChronoGraffApplication() in main.o
      ChronoGraffApplication::MainWindow::MainWindow() in main.o
      ChronoGraffApplication::~ChronoGraffApplication() in main.o
  "juce::Colours::black", referenced from:
      ChronoGraff::paint(juce::Graphics&)       in chrono_graff.o
  "juce::Colours::lightgrey", referenced from:
      ChronoGraffApplication::MainWindow::MainWindow() in main.o
  "juce::Graphics::setFont(juce::Font const&)", referenced from:
      ChronoGraff::paint(juce::Graphics&)       in chrono_graff.o
  "juce::Graphics::setColour(juce::Colour)", referenced from:
      ChronoGraff::paint(juce::Graphics&)       in chrono_graff.o
  "juce::Component::getMarkers(bool)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::keyPressed(juce::KeyPress const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::mouseEnter(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::setVisible(bool)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::focusGained(juce::Component::FocusChangeType)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::addToDesktop(int, void*)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::mouseMagnify(juce::MouseEvent const&, float)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::colourChanged()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::createNewPeer(int, void*)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::broughtToFront()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::centreWithSize(int, int)", referenced from:
      ChronoGraffApplication::MainWindow::MainWindow() in main.o
  "juce::Component::getMouseCursor()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::mouseWheelMove(juce::MouseEvent const&, juce::MouseWheelDetails const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::childrenChanged()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::keyStateChanged(bool)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::mouseDoubleClick(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::enablementChanged()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::paintOverChildren(juce::Graphics&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::parentSizeChanged()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::visibilityChanged()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::childBoundsChanged(juce::Component*)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::lookAndFeelChanged()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::modifierKeysChanged(juce::ModifierKeys const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::createFocusTraverser()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::handleCommandMessage(int)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::inputAttemptWhenModal()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::parentHierarchyChanged()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::userTriedToCloseWindow()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::minimisationStateChanged(bool)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::focusOfChildComponentChanged(juce::Component::FocusChangeType)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::canModalEventBeSentToComponent(juce::Component const*)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::moved()", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::hitTest(int, int)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::mouseUp(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::setName(juce::String const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::setSize(int, int)", referenced from:
      ChronoGraff::ChronoGraff() in chrono_graff.o
      ChronoGraff::ChronoGraff() in chrono_graff.o
  "juce::Component::focusLost(juce::Component::FocusChangeType)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::mouseDown(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::mouseDrag(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
  "juce::Component::mouseExit(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::mouseMove(juce::MouseEvent const&)", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Component::Component()", referenced from:
      ChronoGraff::ChronoGraff() in chrono_graff.o
      ChronoGraff::ChronoGraff() in chrono_graff.o
  "juce::Component::~Component()", referenced from:
      ChronoGraff::ChronoGraff() in chrono_graff.o
      ChronoGraff::ChronoGraff() in chrono_graff.o
      ChronoGraff::~ChronoGraff() in chrono_graff.o
      ChronoGraff::~ChronoGraff() in chrono_graff.o
  "juce::DocumentWindow::getDesktopWindowStyleFlags() const", referenced from:
      vtable for ChronoGraffApplication::MainWindow in main.o
  "juce::Graphics::fillAll(juce::Colour) const", referenced from:
      ChronoGraff::paint(juce::Graphics&)       in chrono_graff.o
  "juce::Component::getDesktopScaleFactor() const", referenced from:
      vtable for ChronoGraff in chrono_graff.o
      vtable for ChronoGraffApplication::MainWindow in main.o
  "typeinfo for juce::DocumentWindow", referenced from:
      typeinfo for ChronoGraffApplication::MainWindow in main.o
  "typeinfo for juce::JUCEApplication", referenced from:
      typeinfo for ChronoGraffApplication in main.o
  "typeinfo for juce::Component", referenced from:
      typeinfo for ChronoGraff in chrono_graff.o
  "non-virtual thunk to juce::JUCEApplication::getAllCommands(juce::Array<int, juce::DummyCriticalSection, 0>&)", referenced from:
      vtable for ChronoGraffApplication in main.o
  "non-virtual thunk to juce::JUCEApplication::getCommandInfo(int, juce::ApplicationCommandInfo&)", referenced from:
      vtable for ChronoGraffApplication in main.o
  "non-virtual thunk to juce::JUCEApplication::getNextCommandTarget()", referenced from:
      vtable for ChronoGraffApplication in main.o
  "non-virtual thunk to juce::JUCEApplication::perform(juce::ApplicationCommandTarget::InvocationInfo const&)", referenced from:
      vtable for ChronoGraffApplication in main.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [bin/ChronoGraffMonitor] Error 1

#2

It looks like you're only including the juce headers, and not building any of the corresponding source files (?)


#3

Hi Jules,

Thanks for the tip. I'll look into that now.

D