在VS2008简体中文版上安装TR1

 

在VS2008中使用#include <regex>,会得到以下错误提示:
fatal error C1083: Cannot open include file: 'regex': No such file or directory
然后google关键字:“Cannot open include file: 'regex': No such file or directory”,可以找到下面这个link:
“Cannot open include file: 'regex'”
可以得到相关解答 为:
[1]
Yes, VC++ 2010 and 2008 SP1 include the TR1 regex library. If you have SP1 installed, but don't have that header, I recommend repairing your Visual Studio installation.
If using a third-party library is an option, I recommend boost's xpressive or regex libraries, the latter of which was the basis for TR1's regex.
[2]
RTM stands for release to manufacturing, which is the originally released version (without service packs). If you installed the service pack you will have a higher version number in Help->About.
[3]
yea, I tried to install the sp1 and the version number increased, and "regex" is in there.
http://www.microsoft.com/downloads/en/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en


然后查看一下本机上安装的VS2008,版本号如下:
Microsoft Visual Studio 2008
Version 9.0.21022.8 RTM
Microsoft .NET Framework
Version 3.5 SP1
因此,在RTM版本上并没有service packs,所以才找不到'regex'。
通过上面的回答,可以找到“Microsoft Visual Studio 2008 Service Pack 1 (Installer)   (VS90sp1-KB945140-ENU.exe 536KB) ”,下载安装发现出错,提示这个更新只支持E版的VS2008:
Installation Requirements:
A compatible version of Visual Studio 2008 was not detected on the system. This update is designed for only the Microsoft Visual Studio 2008 (ENU) product family, and is not compatible with any Express editions.


要删除中文版的再装英文版的比较繁琐,因此继续寻找其他的解决办法。

遇到的问题,说明当前安装的VS2008没有包含regex,在MSDN ( http://msdn.microsoft.com/en-us/ms348103.aspx )上搜索关键字“regex” ,可以搜到一篇名为“<regex>”的文档。然后可以得到关键字“TR1 Regular Expressions”,然后可以进一步找到一下文档等等。
“Standard C++ Library TR1 Extensions Reference”
“TR1 Regular Expressions”
“Quick Start for C++ TR1 Regular Expressions - CodeProject  ”

在“Standard C++ Library TR1 Extensions Reference ”一文中,可以找到以下的提示:
If you start hitting linker errors with this code (even though the includes appear to be present), ensure you download the Visual C++ 2008 Feature Pack Release to get it.
This page should really link to it - http://www.microsoft.com/downloads/details.aspx?FamilyId=D466226B-8DAB-445F-A7B4-448B326C48E7&displaylang=en

 

通过上面的提示,可以找到“Visual C++ 2008 Feature Pack Release ”,根据介绍可知,这个Visual C++ 2008功能包 扩展了VS2008的功能,通过使用这个扩展,MFC程序可以具有更强大的功能。This feature pack also includes an implementation of TR1 . 这就是我们要找的。
在“Standard C++ Library TR1 Extensions Reference”一文中得知:
This reference describes the Visual C++ implementation of the proposed extensions of the C++ ISO standard that are included in the draft document, "Technical Report 1 ." The Visual C++ implementation includes support for fixed-size arrays, function objects, hash tables, regular expressions, template metaprogramming, template types for aggregating related objects, and random-number generation.

 

在“系统要求”一栏中,说明这个功能包仅支持英文系统版本的VS2008,但是下句又说明,对于非英语版本的也可以使用
Support for systems with non-English versions of Visual Studio 2008 installed will be available in Visual Studio 2008 Service Pack 1.

 

然后在MSDN上搜索关键字“Visual Studio 2008 Service Pack 1 ”,可以找到以下文档:
Microsoft Visual Studio 2008 Service Pack 1 (Installer)   (VS90sp1-KB945140-ENU.exe 536KB) ”—— 上文尝试过,这个只能使用于E版的VS2008
Microsoft Visual Studio 2008 Service Pack 1 (iso)   (VS2008SP1ENUX1512962.iso 831.3MB) ”—— 未尝试
可以发现,这两个“Visual Studio 2008 Service Pack 1”除了文件大小不同,其余介绍都一样,下载和安装比较费时,但欣慰的是安装成功了。再次查看VS的版本号,发现版本号比安装前的提高了。
Version 9.0.21022.8 RTM => 9.0.30729.1 sp
对于上面的测试代码不再提示未找到regex的错误提示。下来的工作是做进一步的测试和使用。


参考:
[1] Standard C++ Library TR1 Extensions Reference   (标准C++库TR1的扩展参考)
http://msdn.microsoft.com/en-us/library/bb982198%28v=VS.90%29.aspx
[2] TR1 Regular Expressions
http://msdn.microsoft.com/en-us/library/bb982727%28v=VS.90%29.aspx
[3] Cannot open include file: 'regex'
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/fc2e32b5-e55f-416f-8c74-c018d0f793ab/
[4] MSDN Library for Visual Studio 2008 SP1
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7bbe5eda-5062-4ebb-83c7-d3c5ff92a373&DisplayLang=en
[5] Quick Start for C++ TR1 Regular Expressions
http://www.codeproject.com/KB/string/TR1Regex.aspx
[6] Visual C++ 2008 Feature Pack安装失败
http://zhanyonhu.blog.163.com/blog/static/1618604420094142334417/
[7] vc2008中MFC重大变革-Visual C++ 2008 Feature Pack Beta 发布(附图)
http://www.cppblog.com/woaidongmao/archive/2009/06/19/88092.aspx
[8] Visual C++ 2008 Feature Pack 体验
http://www.cnblogs.com/arowana/archive/2008/01/19/1045244.html


附:“ Visual C++ 2008 Feature Pack Release”说明

 

安装
Visual C++ 2008 Feature Pack Release    (VC2008FeaturePack.exe 322.9MB)

Overview
The Visual C++ 2008 Feature Pack extends the VC++ Libraries shipped with Visual Studio 2008 and is fully covered under Microsoft's standard support policies.
The VC++ 2008 MFC libraries have been extended to support creation of applications that have:
    * Office Ribbon style interface
    * Office 2007, Office 2003 and Office XP look and feel
    * Modern Visual Studio-style docking toolbars and panes
    * Fully customizable toolbars and menus
    * A rich set of advanced GUI controls
    * Advanced MDI tabs and groups
    * And much more!
This feature pack also includes an implementation of TR1 . Portions of TR1 are scheduled for adoption in the upcoming C++0x standard as the first major addition to the ISO 2003 standard C++ library. Our implementation includes a number of important features such as:
    * Smart pointers
    * Regular expression parsing
    * New containers (tuple, array, unordered set, etc)
    * Sophisticated random number generators
    * Polymorphic function wrappers
    * Type traits
    * And more!
Note: This feature pack does not include C99 compatibility or support for special math functions.

System Requirements
    * Supported Operating Systems:Windows Server 2003;Windows Vista;Windows XP
    * Visual Studio: This Feature Pack is only supported on systems which have the English language (ENU) version of Visual Studio 2008 Standard Edition or above installed.
          o Support for systems with non-English versions of Visual Studio 2008 installed will be available in Visual Studio 2008 Service Pack 1 .
    * Microsoft Windows SDK: If you install the Visual C++ 2008 Feature Pack and then install the Windows SDK for Windows Server 2008 and .NET Framework 3.5, some of the files in the Feature Pack are overwritten and lose the additions made by the Feature Pack.
      Resolution:
          o Please install the Windows SDK for Windows Server 2008 and .NET Framework 3.5 first and then the Feature Pack.
          o If you have already installed the Feature Pack first and then Windows SDK, repairing your VS 2008 installation should solve the problem.

Instructions
MSDN online Libraries
The MSDN online libraries have been updated with new documentation and walkthroughs that support the new MFC and TR1 features included in this release. The documentation provides some great content to get you up and running quickly with the new components. The documentation can be found at:
    * MFC http://msdn2.microsoft.com/en-us/library/bb982354.aspx
    * TR1 http://msdn2.microsoft.com/en-us/library/bb982198.aspx

Additional Information
VC Redist Package
The VCRedist_x86.exe package has been updated with this refresh to resolve previous installation and deployment blocking issues.

 

引自:http://blog.csdn.net/delphiwcdj/article/details/6193161

你可能感兴趣的:(Microsoft,service,regex,documentation,library,reference)