Set Up iOS project to use eigen

c++, compiler-construction, eigen, objective-c, xcode4.3

Solution

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

Problem

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. - 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. - 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++. - 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.

Original source

Related problems