Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Up iOS project to use eigen

I'm trying to set up an iOS project to compile a c++ library called Eigen for Linear Algebra maths.

I begin following the instructions of the Question mentioned in:

How to compile Eigen in iPhone

But there are still some kind of things I could not figure out.

  1. User Stafan said to set the right compiler flags (-mfpu=neon -mfloat-abi=softfp). Where do I set those flags? I already found out to set flags for a single file like in http://meandmark.com/blog/2011/10/xcode-4-setting-compiler-flags-for-a-single-file/. But for what files do I need to set this flags? Especially the c++ files from the Eigen library do not appear here.
  2. User Blukee said that he used armv7 optimized arch in build setting. In build settings I see in the Architectures category a green field saying Standard(armv7) is that what right?

I just created a ,,singleViewApplication'' and wanted to use the c++ files in an new Objective C class called MathLibary. Because some guys said that it is possible to mix up Objective C and C++ if I name the class MathLibary.hh and MathLibary.mm. The class looks like

#import "MathLibary.hh"
#define EIGEN_DONT_VECTORIZE
#import "SVD.h"
@implementation MathLibary

@end

When I try to run the App the build fails an the compiler gives out some errors like: In line 47 in SVD.h file, which is:

typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;

The error is Expected a qualified name after 'type name'

For me it sounds as that the compiler tries to compile the SVD.h as objective c file but is c++.

  1. How do I change the compiler to compile both objective c files for the user interface and the c++ files from the library

I hope that somebody is able to help me, thanks a lot.

like image 339
rcpfuchs Avatar asked Jun 02 '12 11:06

rcpfuchs


People also ask

How do I add an Eigen library?

go to codeblocks Settings-> complier-> Search Directories-> Add-> enter the address of the folder you chose in (1)-> o.k. declare #include "Eigen/Dense" before the main function.

How do I add Eigen to Visual Studio?

To install eigen just double click on C:/workspace/eigen-3.3. 4/build-vc14/Eigen3. sln solution file. This action will open eigen project in Visual Studio C++ 14 2015.

Is Eigen header only?

ARPACK-Eigen is implemented as a header-only C++ library, whose only dependency, Eigen, is also header-only.


1 Answers

If you want to mix ObjC and C++, did you make sure to rename your file to have a ".mm" suffix? :)

like image 173
jd. Avatar answered Oct 03 '22 16:10

jd.