再介绍一个谷歌的,自带光环的库–libphonenumber.
虽然这个库是用c++写的,但是我们在网络上很少见到在C++开发中使用这个库,或是说在windows开发中使用这个库。也就是几乎很难找到如何编译libphonenumber.lib 和 libphonenumber.dll.
所以,今天就要与大家分享一下,如何编译libphonenumber.lib,以及简单的使用。
libphonenumber简介
phonenumber是用于解析、格式化、存储和校验电话号码的Java、C++或 JavaScript类库。
Google’s common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers. The Java version is optimized for running on smartphones, and is used by the Android framework since 4.0 (Ice Cream Sandwich).
github地址:
https://github.com/googlei18n/libphonenumber
准备工作
我们先进入cpp:
https://github.com/googlei18n/libphonenumber/tree/master/cpp
看看这里的README,往下翻,你会感到很兴奋:
Building the library on Windows (Visual Studio)
-----------------------------------------------
The library was tested with Visual Studio 2010.
You will need to manually fetch and install the following dependencies:
- CMake (tested with v2.8.6):
http://cmake.org/cmake/resources/software.html
* Download and install the Win32 installer.
- Boost (tested with v1.44) from BoostPro:
http://www.boostpro.com/download/
* Select all the variants and Boost DateTime and Boost Thread during the
installation process.
See Linux instructions for information about thread-safety.
- GTest (tested with v1.6.0):
http://code.google.com/p/googletest/downloads/list
* Open msvc/gtest-md.sln with Visual Studio and build the whole solution.
- ICU (MSVC binaries, tested with v4.8.1):
http://site.icu-project.org/download/48#ICU4C-Download
* Simply extract t