Armadillo library and Eclipse [message #903405] |
Thu, 23 August 2012 13:54 |
Carlos MG Messages: 2 Registered: August 2012 |
Junior Member |
|
|
Hi everybody!
Firs of all, I want to say that I am a beginner in C++ (just a couple of days...). I want to compile a C++ code that uses the Armadillo library. The (Very simple) code,
#include <iostream>
#include "armadillo"
using namespace arma;
using namespace std;
int main(int argc, char** argv)
{
cout << "Armadillo version: " << arma_version::as_string() << endl;
// random matrix -- values are uniformly distributed in the [0,1] interval
mat E = randu<mat>(4,4);
E = 10.0*E;
E.print("E:");
// inverse matrix
mat G = E.i();
G.print("G: ");
return 0;
}
The code was much longer but I have erased the part that works (like matrix sums, or basic linear algebra commands). I know that the problem is the last part (The // inverse matrix part), because if I comment it, the code is built properly and it runs. However, when I compile the code with the inverse matrix part activated, I get the following error,
Invoking: MacOS X C++ Linker
g++ -o "armadilloexample1" ./armadilloexample1.o
Undefined symbols for architecture x86_64:
"_wrapper_dgetrf_", referenced from:
void arma::lapack::getrf<double>(int*, int*, double*, int*, int*, int*)in armadilloexample1.o
"_wrapper_dgetri_", referenced from:
void arma::lapack::getri<double>(int*, double*, int*, int*, double*, int*, int*)in armadilloexample1.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [armadilloexample1] Error 1
If I compile the code from the terminal, using the command that the Armadillo documentation provides,
g++ armadilloexample.cpp -o armadilloexample -01 -larmadillo
I can build the code with no problem. I have tried to add the flagas "-01 -larmadillo" in the Miscellanious options of the Mac OS X C++ Linker under Building Properties of the project, but it did not work. I also tried "-framework Accelerate" but it did not work either...
Any idea to solve it?? Thank you!
(SO: MAC OS X, Mountain Lion)
[Updated on: Thu, 23 August 2012 14:40] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04305 seconds