要在wince下单独编译boost::regex
1.新建一个dll或者lib工程,将$(BOOST_ROOT)\libs\regex\src下面的
cpp_regex_traits.cpp
regex.cpp
regex_debug.cpp
regex_raw_buffer.cpp
regex_traits_defaults.cpp
static_mutex.cpp
w32_regex_traits.cpp
winstances.cpp
加入到工程中(这里我粗粗测过要去掉的一些源文件,可能有些cpp文件还可以去掉,或者有些cpp文件还需要加入,根据你的需要和编译能否通过)
2.修改工程设置,增加处理器预定义BOOST_NO_STD_LOCALE,
如果是dll工程,那么还需要BOOST_REGEX_DYN_LINK
不使用预编译头
3.修改$(BOOST_ROOT)\boost\regex\config.hpp,用#ifndef _WIN32_WCE括起
# include <string>
extern template class __declspec(dllimport) std::basic_string<unsigned short>;
为
# if !defined(_WIN32_WCE) && !defined(UNDER_CE) && !defined(WINCE) //ADD BY .... FOR COMPILE WINCE REGEX 这是我们自己修改的,做一个标记
# include <string>
extern template class __declspec(dllimport) std::basic_string<unsigned short>;
# endif
4.编译工程,就能得到一个lib或者dll,结合boost的头文件,就能使用了。