Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Armadillo library and Eclipse(Problem compiling armadillo code)
icon14.gif  Armadillo library and Eclipse [message #903405] Thu, 23 August 2012 13:54 Go to next message
Carlos MG is currently offline Carlos MGFriend
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

Re: Armadillo library and Eclipse [message #903416 is a reply to message #903405] Thu, 23 August 2012 14:38 Go to previous message
Carlos MG is currently offline Carlos MGFriend
Messages: 2
Registered: August 2012
Junior Member
Ok! I have just solved it! In miscellaneous MAC OS X linkers, I had to put "-01 -larmadillo" AND I had to deactivate the shared library settings!
Previous Topic:math functions not working on Linux
Next Topic:Pleora/Eclipse c++ integration
Goto Forum:
  


Current Time: Tue Oct 08 00:02:53 GMT 2024

Powered by FUDForum. Page generated in 0.04305 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top