How is the Android app using the STL library

Source: Internet
Author: User

Method:

1. Create a new application.mk under the Jni folder; Add App_stl: = Stlport_static to the right of the value can also be replaced by the following:

System-Uses the default minimal C + + execution library, which makes the resulting application small and memory-intensive, but some features will not support

Stlport_static-use 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 low version of the Android firmware, not recommended for the moment.

Gnustl_static-Using the GNU libstdc++ as a static library

By default, STLport does not support C + + exception handling and Rtti. So do not appear-fexceptions or-frtti; It is possible to use Gnustl_static to support standard C + + features, but the resulting file size will be large and the execution will be less efficient.

Supports C + + exception handling. Add Local_cppflags +=-fexceptions in Application.mk, and support Rtti in the same way, add Local_cppflags +=-frtti. Here again, the second one says use Gnustl static library, not stlport.

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

2. Include the associated header file in the CPP file to use the STL, and make use of the using namespace Std;


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

How is the Android app using the STL library

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.