ndk build with Visual studio files - stl

I am building an android app using the native classes. The problem is that there are some cpp files calling OpenCV and the opencv header files calling VC includes that are not provided in jni. So what should I do? create a new opencv folder and change every opencv files there to right paths? or any other ways to config it? because I don't want to change the original opencv folder. that's for VC programming.

<algorithm> is one of the STL headers. You should enable STL support in NDK, as described in docs/CPLUSPLUS-SUPPORT.html document.

pointed out the thing. I need to put those to Application.mk. Thought this file is optional.

Related

How does Cocos2d-x keep code (C++ file) safe from decompilation?

I just decompiled APK using dex2jar and JD-GUI to access the source code, but I could not find any .h or .cpp files in classes.dex folder. I want to know how does Cocos2d-x take care of that issue and where are all these files stored?
the c++ files are compiled into a dynamic library, in lib/armeabi/, like libxxx.so

Erlang: How to include libraries

I'm writing a simple Erlang program that requests an URL and parses the response as JSON.
To do that, I need to use a Library called Jiffy. I downloaded and compiled it, and now i have a .beam file along with a .app file. My question is: How do I use it? How do I include this library in my program?. I cannot understand why I can't find an answer on the web for something that must be very crucial.
Erlang has an include syntax, but receives a .hrl file.
Thanks!
You don't need to include the file in your project. In Erlang, it is at run time that the code will try to find any function. So the module you are using must be in the search path of the VM which run your code at the point you need it, that's all.
For this you can add files to your path when you start erlang: erl -pa your/path/to/beam (it exists also -pz see erlang doc)
Note that it is also possible to modify the path from the application itself using code:add_path(Dir).
You should have a look to the OTP way to build applications in erlang documentation or Learn You Some Erlang, and also look at Rebar a tool that helps you to manage erlang application (for example starting with rebar or rebar wiki)
To add to Pascal's answer, yes Erlang will search for your files at runtime and you can add extra paths as command line arguments.
However, when you build a project of a scale that you are including other libraries, you should be building an Erlang application. This normally entails using rebar.
When using rebar, your app should have a deps/ directory. To include jiffy in your project, it is easiest to simply clone the repo into deps/jiffy. That is all that needs to be done for you to do something like jiffy:decode(Data) in your project.
Additionally, you can specify additional include files in your rebar.config file by adding extra lines {erl_opts, [{i, "./Some/path/to/file"}]}.. rebar will then look for file.so using that path.

Accessing a resource file manually

I'm using a 3rd party library that does serialization and deserialization of it's data, I need to feed the library a data file that I have stored under Resources.
I can't use FileUtils to read the contents of the file, I need to do let the 3rd party library do the reading of the file.
I need to get the full path of the file so the library can find it.
FileUtils::getInstance()->fullPathForFilename("file.map");
returns assets/file.map on Android which is not found by ifstream when given that path.
How do I read a file manually, given that it's located in Resources?
You can't use ifstream to operate with bundle resources on android because they're located in the apk file (in archive).
You can use the FileUtils::getInstance()->getDataFromFile("file.map") to get binary data and try to transfer it to your library.
Also You can look at this answer link to answer. It might help You too.

A small example about using Library Path in flash IDE

I know how to use Source Path ( which is just an another source folder). But could never figure out how to make use of library path.
Any small written code example over using and understanding this concept would be appreciated.
I know using SWCs too.. but how can i use a bunch of classes which are not in SWC form, in my library path ?
( Additionally , why Flex SDK not included in Source path.. rathar than in library path ?)
Thanks
V.
The library path is for pointing to compiled code sources like SWC files.

Difference between libs and src folder

What's the difference between libs and src folders?
The source folder is for ActionScript and Flex source files, mostly with .mxml or .as extensions. Anything you code you put in the src folder, though if you create your own library of reusable code, you might keep it in a second source folder (with another name, of course).
The libs folder is a special folder in Flash Builder, that you can put .swc files in. These SWCs (pronounce 'swicks') contain compiled code already. 3rdparty frameworks (or libraries) are easy to use by downloading their SWCs, and you can also create SWCs with assets from the Flash IDE, for easy access to your asset library. Hence, I guess, the naming of the folder 'libs'. The SWCs in the libs folder are automatically added to the classpath of your project, so you can access the classes therein.
Cheers,
EP.
P.S. Worth noting is that in other development IDE's like FDT or FlashDevelop, SWCs in the 'libs' folder are not neccessarily added to the classpath automatically and might need a little manual configuration.
src should contain your source code. lib contains the librairies that you reference and use in your code (.jar files for example).
EDIT : For Flex projects, you put in lib the .swc files that you load from your source code.