I am new to Mac and also Armadillo. Here's what I've done to use C++ with Armadillo.
Aside from that it's basically factory settings on the Mac.
Downloading armadillo seemed to work in brew, but I'm not really sure what to do next, because my code (shown below) still isn't compiling. It still says armadillo can't be found.
#include<iostream>
#include<armadillo>
using namespace std;
using namespace arma;
int main(int argc, const char * argv[]) {
mat A;
A << 1 << 2 << endr << 3 << 4 endr;
cout << A << endl;
return 0;
}
I know there's probably something simple I'm missing but I'm pretty new to all of it so I'd appreciate advice, thanks.
I used the default cmake options, so my armadillo.h .dylib ended up in /usr/local/include and /usr/local/lib, respectfully.
1) Add the paths containing armadillo.h and the armadillo.5.20.2.dylib to Header Search Paths, and Library Search Paths.
Search Path Screenshot
The search dialog box is useful in locating the aforementioned project parameters.
2) Add the dylab as a target dependency
Link Binary With Libraries Screenshot
Click '+' -> Add Other -> ⌘ Shift G -> /usr/local
Then select /usr/local/lib/armadillo.5.20.2.dylib
In restrospect it is probably better to run cmake with an alternate install location such as:
cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt
In which case the ⌘ Shift G step is unnecessary, and one can probably see the /opt directory from Finder by typing sudo SetFile -a v /opt
So I found out after searching around. The fact that /usr/bin/ was hidden was really confusing me, but you can just cd there from the Terminal, I guess. Then Armadillo was at the path /usr/local/Cellar/armadillo/4.600.2/include, which I copied into Search Paths -> Header Search Paths in Xcode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With