0
votes

I am a Mac OS X 10.8.3 user (Mountain Lion). I have download armadillo and installed it in OS X as per README.txt instructions. It compiles fine by typing:

g++ ... *stuff* ... -O2 -larmadillo

in the terminal. By including the same linker arguments in Eclipse CDT, I have been able to compile armadillo in Eclipse (Juno) in OS X. However, my problem is when it comes to compiling in Xcode 4 -- the program I need to have armadillo in! I have already tried adding the "-O2 -larmadillo" string to the other linker flags. I also tried adding /usr/local/lib and /usr/local/include/ in Header Search Paths and Library Search Paths. I have gotten Xcode 4 to thus recognize the command:

# include < armadillo >

or

# include "/usr/local/include/armadillo"

HOWEVER, when it comes to compile time Xcode 4 does NOT recognize a line like:

mat A;

So for the code:

# include < iostream >

# include < armadillo >

using namespace std;

int main() {

    mat A;

    return 0;

}

I get errors like:

Use of undeclared identifier 'mat'; did you mean 'max'?
Expected ';' after expression
Use of undeclared identifier 'A'

Reference to overloaded function could not be resolved; did you mean to call it?

Note that the code does not even get to the compile stage!

I would like to now : how do I properly link and compile a C++ code which uses the armadillo library in Xcode 4???

Thank you very much!

Daniel.

1

1 Answers

3
votes

did you forget to add "using namespace arma"? ie.

# include <iostream>
# include <armadillo>

using namespace std;
using namespace arma;  // make Armadillo classes and functions visible by default