Android STL PORT

Source: Internet
Author: User

The NDK contains the STL-corresponding library, in $ (nkd_home)/sources/cxx-stl/stlport/stlport

A summary of C + + STL development related to the Android NDK is as follows:

  1. From the Android NDK R5 began to support the STL Port, the beginning of this version can use some of the functions of the STL library, such as vector, map,string get rid of C easy to appear in the array uninitialized, out of bounds, enhance the robustness of the application. Do not include the relevant header file will be reported compilation Error!

  2. Many netizens include the include header, but still cannot compile, here you first want to check whether the current file is a. cpp suffix, and in order to use the standard library must join APP_STL: = stlport_static in the application.mk file. There is also the system using the default minimal C + + runtime, so that the resulting application volume is small, the memory footprint is small, but some features will not support stlport_static using STLport as a static library, which is highly recommended by the Android Development Network Stlport_ Shared STLport as a dynamic library, this may produce compatibility and some of the lower versions of the Android firmware, currently not recommended for use. Gnustl_static using the GNU libstdc++ as a static library

  3. By default, STLport does not support C + + exception handling and rtti, so do not appear-fexceptions or-frtti, if you really need to be able to use gnustl_static to support the features of standard C + +, but the resulting file volume will be large and run less efficiently. Support C + + exception handling, add Local_cppflags + =-fexceptions in application.mk, similarly support rtti, then add local_cppflags + =-frtti, Here Android123 again to remind you, the second said to use Gnustl Static library, instead of STLport

  4. Force recompile STLPort, add Stlport_force_rebuild in application.mk: = True to force recompile STLPort source code, for some reasons may need to modify the next STLPort library, General developers do not need to use this item.

  5. Android currently has an updated NDK version, related learning can look at the samples overall in the NDK and development on the PC is not much different.

  6. It is highly recommended to do Android NDK development for children's shoes according to their NDK version, Write APPLICATION.MK support platform, because you reference the version of the STL library is based on your version of the NDK, if you support the platform for the STL compatibility problems, the generated library file may report the failure to load the error, and strongly recommend not to use the STL's dynamic Library

  7. NDK r5b to Gnustl and stlport support difference is very large, do not casually confuse, or your program surface compilation success, surface will bring you endless trouble!!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.