Armadillo, JUCE and Xcode 10

Hi, I’m trying to include the Armadillo library ( in my JUCE project (an audio plugin that does virtual analog modeling) in order to have an easier way to manage complex matrix operations. I’ve installed it in the right way, and I’m sure about this because if I compile their example .cpp file with the terminal it works as expected without any errors. But in Xcode I simply can’t see the library, I’ve followed all the guides online but none of them has worked for me. As you can see in the pictures I’ve set the right “header search paths” and “library search paths” and “other linker flags” but it keeps saying that it can’t find the “armadillo” file. I’ve checked and the armadillo file is exactly where it should be, in usr/local/include !! The same for the libraries. There is someone that knows how to make this thing work? As I said if I compile and run the example file with the terminal it work perfectly, so the problem is Xcode I suppose. I’m using Xcode 10.1 on the latest macOS version.
Thank you!

Never worked with Armadillo so far but just tried to set it up quickly (however with Xcode 9).
Steps that lead to success in a few minutes:

  • Installing Armadillo via Homebrew
  • Creating a new Command Line Application in the Projucer
  • Setting those fields in the Xcode exporter:
    • External Libraries to Link: armadillo
    • For Debug and Release config: Header Search Paths: /usr/local/include
    • For Debug and Release config: Extra Library Search Paths: /usr/local/lib


#include "../JuceLibraryCode/JuceHeader.h"
#include <armadillo>

int main()
    arma::mat A = arma::randu<arma::mat>(4,5);
    arma::mat B = arma::randu<arma::mat>(4,5);
    std::cout << "Some Armadillo output:\n\n" << A * B.t() << std::endl;
    DBG ("And some JUCE DBG call");
    return 0;

Does that work for you too this way?

If you want to keep it as portable as possible I would always recommend you to set the library stuff in the Projucer directly. The Xcode settings you did might be overwritten if you re-save the project with the Projucer.

Side note: I never used Armadillo because I always use Eigen for linear algebra matrix stuff. I really like it and besides that, it is a header only library which makes it super easy to use… Maybe that might be an option for you too, however I see that this was not your original question :wink:

1 Like

Thank you so much for your answer, I found a huge mistake! I’ve written usr/local instead of /usr/local, now the file armadillo is recognized. I can’t make it work with classes but I’ll find for sure a solution, I’m probably doing something wrong. I’ll see also Eigen, thanks for the suggestion!

Glad I could help you. I didn’t see the missing / in your original post either :wink:

What do you mean by that?

oh nothing important, when I declare a matrix like “mat Q(3,7)” in a class I get an error, while outside a class, for example in a code like the one you posted before it works. I don’t know why but I’ve no time to search for a solution these days, so I’m switching to Eigen, which seems simpler

Ok seems like you are just starting with it all.

Although I can totally understand the “I don’t have time to search for a solution” argument I’d still encourage you to try to understand each error you’ll face. From reading how you described the error I’m nearly 100% sure that the error you get has nothing to do with the library but rather with some C++ language feature you might not know at the moment or so… Understanding such errors and learning how to fix them, especially learn how to understand compiler errors can be a bit complicated at the beginning but will ultimately lead to a much much faster workflow and of course bug free code.

My point is to encourage you to either try to use this community to understand your errors and get them fixed or don’t give up googling until you really understood it :slight_smile:

1 Like

Yeah you’re totally right, usually I never leave an error without trying to fix it and understanding it. Unfortunately I have only 2 days to complete this project (I’ve been asked to make this plugin yesterday -.-), so I have to work as fast as possible. After that I will 100% try to understand everything, thanks again for your responses!