在低版本的 vc 中使用 vc 10.0 的新特性
*!
版本 vc 使 vc 10.0 新特性
created by : andrew.wu (erpingwu@gmail.com)
*/
vc 10.0 提供些新特性,最引人注目莫过于 lambda, 但 vs2010 beta 存占不得不让人心生退让.
手 7cat 指出 "vc ide 只个壳"
那么如果利 vc 10.0 编译器新功能?
以vc9例, 注意 Tools->Projects and Solutions->VC++ Directories->Executable files->$(VCInstallDir)bin, 这个说明IDE所cl.exe, link.exe等工具所.此目录新增个 $(VCInstallDir)bin_vc10.0, 所需 vc10.0 文 copy 过去.
c1.dll
c1xx.dll
c2.dll
cl.exe
cl.exe.config
link.exe
link.exe.config
msobj100.dll
mspdb100.dll
mspdbcore.dll
mspdbsrv.exe
msvcm100.dll
msvcp100.dll
msvcr100.dll
然找个例子试试,就 c++ 0x lambda 已经能所, 这时发布程序所 dll 还 vc9 .
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
[](const string& str){
cout << str << endl;
}("Hello vc 10.0");
}
MS vc10 说法 “10 Is the New 6”,这点只个地方有体现,不速度,不 IDE 存占,表现程序最终发布。阿门, vc 10.0 再次以通过 xcopy 发布,而不辛苦 manifest 做各种 hack 式处理。
不过,即使 vc 10.0 link.exe ,还不能摆脱 vc9 困境。这时有个更夸张点做法:不仅仅使 vc 10.0 编译连接工具,还使库。
只需 Tools->Projects and Solutions->VC++ Directories->Include files Library files 增加 vc 10.0 应目录(注意需 vc9 原目录)
重建项目以程序所需 vc 10.0 dll 直接 copy 没有 vc 10.0 运行库机器使
以步骤 vc 7.1 测试通过