Make problem in Linux (Ubuntu)


#1

I got stuck with compiling my app under Ubuntu. I followed many instructions I found on the forum, I got jucer and juce demo built without any problems, but I just can’t do the same with my own app.
I don’t use Eclipse, only pure Makefile generated by premake using the premake.lua from the juce demo (I deleted the unnecessary source paths, and renamed the project).
When I type

it starts to compile the cpp-s like

==== Building App ====
ApplicationStartup.cpp
Linking App
build/intermediate/Debug/MainAppWindow.o: In function `MainAppWindow':

then breaks (at Linking) printing a lot of errors such as:

/src/MainAppWindow.cpp:43: undefined reference to `juce::String::String(wchar_t const*)'
/src/MainAppWindow.cpp:43: undefined reference to `juce::DocumentWindow::DocumentWindow(juce::String const&, juce::Colour const&, int, bool)'
...

So it returns with undefined reference errors about every little components I used from juce.
I don’t really get it, because theoretically the juce demo used the same paths, same lua, and worked fine.
What am I missing?


#2

Well you either have to have the amalgamated cpp file somewhere in your project, or you need to link to the juce lib… Otherwise how would it actually get any of these classes!


#3

The juce_amalgamated.h is included both in MainComponent.h and MainAppWindow.h, and the premake.lua contains the following

package.libpaths = { "/usr/X11R6/lib/", "../../../../bin/" }
/bin contains both libjuce.a and libjuce_debug.a

So it should work, but I keep getting those errors.


#4

…erm, right, but just setting the path won’t make it load the lib file - if you want the linker to use a library, you do actually have to tell it!


#5

Could you explain how to do that? I just can’t figure it out how to make it work.


#6

Damn, how frustrating this thing is…
My problem was, that I started with haydxn’s tutorial app, which worked in Windows environment just great. So I was done with my app there, then I wanted to compile it in Linux as well. And the fact I couldn’t succeed was I didn’t use these:
juce_AppConfig.h
juce_LibrarySource.cpp
juce_LibrarySource.mm
I tried (for a whole day) to modify my four files (and even my lua and make files) to make them work.
Finally I copied the mentioned files to my src/ folder, included juce_AppConfig.h where juce_amalgamated.h was included, and YEEY, it worked.


#7

You need to add a line like this to your Premake script:

This tells your application to link to the Juce library, so it can resolve those missing symbols. You basically did the same thing by putting all the Juce sources into your own project.

(That might not be the right library name, look to see what what got produced by the Juce build).


#8

actually I tried to do as you said, but I got this error every time:

or

I also tried without putting the extension after the library name. Libpaths are given including “…/…/…/…/bin/” (this is where the .a files are)


#9