How to Use boost. RegEx in Open C/C ++ applications

Source: Internet
Author: User

Although the release of the new open C/C ++ SDK supports libraries such as stlport and boost, the boost support is incomplete. The RegEx library was initially tested earlier, and many errors were prompted during compilation. The test example can be run after the test is completed. The specific process is described below:

My test environment is: SDK: s60 3rd Mr Ed + Open C/C ++ SDK; ide: carbide. c ++ 1.3

0. Preparations

Install the openc/C ++ SDK. Create a regex_ex project based on the boost example provided by the SDK. The RegEx example can be found online, for example:

Http://www.cs.brown.edu /~ Jwicks/Boost/libs/RegEx/doc/examples.html
Http://www.onlamp.com/lpt/a/6535

1. Custom boost options:

Open the boost/config/user. HPP file and define the following two macros)
# Define boost_disable_win32
# Define boost_all_no_lib

2. modify the definition of min_wchar

Open the wchar. h file and set

# Define wchar_min (wchar_t) _ int_min

Change
# Define wchar_min _ int_min

That is, remove wchar_t force conversion. Otherwise, this will cause an inexplicable problem during macro judgment.

The definition of wchar_max can be retained and is not used.

3. Fixed a problem in the boost. RegEx Library:

Open boost/RegEx/V4/basic_regex_parser.hpp and modify

  1. STD: ptrdiff_t Len = (STD: min) (static_cast <STD: ptrdiff_t> (2), m_end-m_position );

Is

  1. STD: ptrdiff_t Len = (STD: min) (static_cast <STD: ptrdiff_t> (2), static_cast <STD: ptrdiff_t> (m_end-m_position ));

4. Compile and link the source code of RegEx

I do not know whether the Open C/C ++ SDK has the Lib file of the boost. RegEx library. What I use is to compile the Code directly from the RegEx source code (download boost1.35 ).

Finally, the boost. RegEx test example was successfully passed on both the emulator and the real machine.

Related Article

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.