Armadillo and XCode

Hi all!

Very simple question, I think, but I have started to learn C++ two days ago... I am trying to use the Armadillo library. I write a .cpp file and I have no problem compiling it from the terminal, using

g++ main.cpp -o main -01 -larmadillo

However, when I try to run the code from XCode, I always get the error that 'armadillo file not found', but I don't know how to link Xcode to Armadillo to make it work... The code is just this,


#include <iostream>
#include "armadillo"

using namespace arma;
using namespace std;

int main(int argc, const char * argv[])
{

// Armadillo version
cout << "Armadillo version: " << arma_version::as_string() << endl;
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}


Thanks in advance!
I dont know but I think you must locate where the armadillo file is.
eg: #include<bcc\armadillo.h>
I am really curious...what does Armadillo do for you?
kaseron, it is a linear algebra library, that makes C++ coding closer to MATLAB (for people like me it is a great advantage) http://arma.sourceforge.net/

Aceix, now it recognizes the file (I added "/usr/include/armadillo"). But now I have other problem... when it is compiling, I get this error:

"Lexical or Preprocessor issue: 'initializer_list' not found. The error is given in the armadillo file,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2012 Conrad Sanderson
// 
// This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness
// for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3
// of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info)


#ifndef ARMA_INCLUDES
#define ARMA_INCLUDES


#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>

#include <iostream>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include <limits>
#include <algorithm>
#include <complex>
#include <vector>


#include "armadillo_bits/config.hpp"
#include "armadillo_bits/compiler_setup.hpp"
#include "armadillo_bits/undefine_conflicts.hpp"


#if defined(ARMA_USE_CXX11)
  #include <initializer_list>
#endif


#if !defined(ARMA_HAVE_GETTIMEOFDAY) && !defined(ARMA_USE_BOOST_DATE)
  #include <ctime>
#endif


(The code continues...)

Thanks!
Last edited on
Ok...so, I could not make it work. However, I switched to Eclipse, and everything works fine there! I guess that no more Xcode for me (unless anyone has an idea on how to resolve my previous issue...)
Topic archived. No new replies allowed.