Undefined references in linux only


#1

I am trying to compile my friend’s Juce application which he is developing on XCode using the Makefile he generated using the Introjucer. The app builds fine on XCode. When I try to build it using the Makefile on Linux I get a errors about undefined references to classes defined in the .h he has written. The error is very similar to the error I get when I try to build Mios_Studio at revision 1188:

==== Building MiosStudio ====
MiosStudio.cpp
LogBox.cpp
Linking MiosStudio
build/intermediate/Debug/MiosStudio.o: In function `SysexToolWindow':
/home/kaspar/alphasphere/code/juce/mios32/trunk/tools/mios_studio/build/linux/../../src/gui/SysexTool.h:155: undefined reference to `SysexTool::SysexTool(MiosStudio*)'
build/intermediate/Debug/MiosStudio.o: In function `SysexToolWindow::handleIncomingMidiMessage(juce::MidiMessage const&, unsigned char)':
/home/kaspar/alphasphere/code/juce/mios32/trunk/tools/mios_studio/build/linux/../../src/gui/SysexTool.h:173: undefined reference to `SysexToolReceive::handleIncomingMidiMessage(juce::MidiMessage const&, unsigned char)'
build/intermediate/Debug/MiosStudio.o: In function `OscToolWindow':
/home/kaspar/alphasphere/code/juce/mios32/trunk/tools/mios_studio/build/linux/../../src/gui/OscTool.h:144: undefined reference to `OscTool::OscTool(MiosStudio*)'
build/intermediate/Debug/MiosStudio.o: In function `Midio128ToolWindow':
/home/kaspar/alphasphere/code/juce/mios32/trunk/tools/mios_studio/build/linux/../../src/gui/Midio128Tool.h:276: undefined reference to `Midio128Tool::Midio128Tool(MiosStudio*)'
build/intermediate/Debug/MiosStudio.o: In function `Midio128ToolWindow::handleIncomingMidiMessage(juce::MidiMessage const&, unsigned char)':
/home/kaspar/alphasphere/code/juce/mios32/trunk/tools/mios_studio/build/linux/../../src/gui/Midio128Tool.h:294: undefined reference to `Midio128ToolControl::handleIncomingMidiMessage(juce::MidiMessage const&, unsigned char)'
build/intermediate/Debug/MiosStudio.o: In function `MbCvToolWindow':
/home/kaspar/alphasphere/code/juce/mios32/trunk/tools/mios_studio/build/linux/../../src/gui/MbCvTool.h:232: undefined reference to `MbCvTool::MbCvTool(MiosStudio*)'
build/intermediate/Debug/MiosStudio.o: In function `MbCvToolWindow::handleIncomingMidiMessage(juce::MidiMessage const&, unsigned char)':
/home/kaspar/alphasphere/code/juce/mios32/trunk/tools/mios_studio/build/linux/../../src/gui/MbCvTool.h:250: undefined reference to `MbCvToolControl::handleIncomingMidiMessage(juce::MidiMessage const&, unsigned char)'
build/intermediate/Debug/MiosStudio.o: In function `MbhpMfToolWindow':
/home/kaspar/alphasphere/code/juce/mios32/trunk/tools/mios_studio/build/linux/../../src/gui/MbhpMfTool.h:335: undefined reference to `MbhpMfTool::MbhpMfTool(MiosStudio*)'
build/intermediate/Debug/MiosStudio.o: In function `MbhpMfToolWindow::handleIncomingMidiMessage(juce::MidiMessage const&, unsigned char)':
/home/kaspar/alphasphere/code/juce/mios32/trunk/tools/mios_studio/build/linux/../../src/gui/MbhpMfTool.h:353: undefined reference to `MbhpMfToolControl::handleIncomingMidiMessage(juce::MidiMessage const&, unsigned char)'
collect2: ld returned 1 exit status
make[1]: *** [build/MiosStudio] Error 1
make: *** [MiosStudio] Error 2

At revision 1189 Mios_Studio links and builds fine and you can have a look at the diff. It seems to have something to do with the instantiation of the Classes but I can’t quite figure out why those changes are made and how they fix the linking problem. Can anyone shed some light on what is going on here and how I could do the same for my friend’s app?


#2

Did you do a clean before your build?

Bruce