Set Up iOS project to use eigen - c++

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.

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

Related

how to use aidl-cpp to generate .aidl to c++ code

What I need: compile .aidl file to c++ code
What I found: Generating C++ Binder Interfaces with aidl-cpp
AIDL compiler for C++ on Linux Desktop
3.What I did:I had clone the "aidl-cpp" on the second link,after viewing the many files in the project,I was missing.
Some doubt here:
Can I compile this project and use the target to compile my
project?If yes,I need the whole android platformtsource code in my
system path?Because I try to compile one single file main_java.cpp
with g++ commandline , and it returns some "android-base" libs
cannot find.
Or I can write my own cpp file to implement the interfaces defined
in my .aidl files imitate the "aidl-cpp" project.This way I haven't
tried.
What's the right way to meet my need?
You can just use aidl of android sdk build-tools after 29.0.0.
aidl --lang=ndk <input.aidl>

Embarcadero and free opc ua

I'm trying to get an app working with a PLC. I'm using this library: https://github.com/FreeOpcUa/freeopcua
example code: https://github.com/FreeOpcUa/freeopcua/blob/master/src/examples/example_client.cpp
But when I include the header files(like in the example) from the library it gives an error:
Non-Virtual function 'DateTime::DateTime(const DateTime &)' declared pure.
When I search the specific line of this error it shows me this:
DateTime(const DateTime&) = default;
I already asked it on the github page, and they are saying it has something to do with my compiler. I never touched it, so it shouldn't be having odd options.
So how can I solve this? And if there is something wrong with my compiler, How can I change my compiler options to get it fixed?
Yes, bcc32 don't allow to create instance of abstract class. So you can change target platform to win64 and compile without errors.
Another way, as Thorsten Schöning said, you can use C++ Builder 10 with bcc32c based CLANG compiler and do it also without errors.

Xcode noob: Don't understand compiler error message

I'm fairly new to Xcode and have recently gotten an error message that is probably clear to anyone who knows what they're doing, but I am unsure how to react to this one.
I have a project that is mostly C++, with just a few C files in it. Everything was fine until I tried to add some code to find the computer's MAC address. Apple provides a project example (GetPrimaryMACAddress), and I downloaded, built, and tested that. It works just fine.
After that, I simply copied the C source from the Apple example project and included it into my code project. Then I started getting this error message:
I have tried including the IOKit framework explicitly via the linker; no help. I tried adding more #include statement to the Apple example code; no help. I think that I do not understand what the compiler message is telling me regarding importing from module 'Darwin.MacTypes'.
Clicking on the error message took me to a line in usr/include/MacTypes.h:
I'm not clear on how to Import Darwin.MacTypes. I don't really understand how the source code for GetMACAddress could compile so effortlessly in one project and not another. I didn't rearrange nor add nor delete any of the #include statements in the Apple-supplied C file.
I'll bet there is a simple answer that I am just not seeing. How should I react to this error message?
I had a similar problem with types like UInt16 and UInt32. I just included the MacTypes with the following include statement:
#include <MacTypes.h>
This solved all my type-problems for my example c-file.
Let me guess, when you want to compile C++ source, you should create a C++ source file
(On the toolbar: File > New > File.. > Source > C++ File)

Eclipse CDT c++ project using C headers and doing cross compile

we have an application which is written in c++ and now we are trying to use the same application on the ARM board for which we were provided a toolchain.
So when i do a test c++ project it compiles ok and code on the target is executed perfectly.
As we want to use also some of the functionality of the target (eg display,...), that part is for C, headers are C, libraries are C.
So when i tried including C headers i got a lot conversion errors (eg. Description invalid conversion from unsigned int' tostlv_type' locaion: tlv_tags.h C/C++ Problem)
For example function generating problems:
static inline
enum stlv_type _stlv_get_tag_type(unsigned int tag)
{
return STLV_GET_TYPE(tag);
}
When creating C project this all works without a problem, but c++ project hundreds of conversion errors.
So i tried to include this headers in extern "C" block without any success, still same problems.
So can somebody help me combine this :) as there is no possiblity to get c++ from the manufacturer and also changing headers is not an option as new platform releases can come at any time.
Thanks in advance!

Building C++ application for eCos on ARM

I'm looking to build a C++ application for eCos on an ARM processor. My program requires several standard C++ header files such as vector, iostream, list, ...
My question is: how can I achieve this? Does anyone have any experience building and deploying C++ applications for eCos?
When I use the arm-eabi-g++ compiler to compile the application, I get the following error
fatal error: vector: No such file or directory
meaning that the C++ vector library is not present.
However, the arm-none-eabi-g++ compiler does include these standard header files. I do get the following errors for '':
In file included from /opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/bits/locale_facets.h:43:0,
from /opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/bits/basic_ios.h:39,
from /opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/ios:45,
from /opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/ostream:40,
from /opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/iostream:40,
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:44:35: error: '_U' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:45:32: error: '_L' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:46:32: error: '_U' was not declared in this scope
...
Can I use the arm-none-eabi-g++ compiler for eCos? If yes, how do I solve these errors? If no, what should I do?
Many thanks in advance!
vector, list, they are basically belong to Standard template library. For ecos there might be something similar available likewise BOOST.
I think u can check this link
You need ustl. See Using uSTL in eCos applications.
Here's a short example for using vector.
You must include
#include <ustl.h>
Then you may instantiate a vector like so:
ustl::vector<int> v(2);