IDE:VS

来自bbxwiki
跳转至: 导航搜索

SN

  • VS2010: YCFHQ-9DWCY-DKV88-T2TMH-G7BHP
  • VS2012
    • Express for Windows Desktop: MMVJ9-FKY74-W449Y-RB79G-8GJGJ
    • Express for Web: VX3VY-8GCVT-KJQCY-RQ99X-MCF2R
    • Express for Win8: YV688-DW39R-JPKH2-6DG4R-HM9JD
    • Ultimate 旗舰版: YKCW6-BPFPF-BT8C9-7DCTH-QXGWC
    • Premium 高级版: MH2FR-BC9R2-84433-47M63-KQVWC
    • Professional 专业版: 4D974-9QX42-9Y43G-YJ7JG-JDYBP


vs2010缺省include,lib目录设置

  • 打开%USERPROFILE%\AppData\Local\Microsoft\MSBuild\v4.0目录, 修改相应的win32,x64文件
  • 方便后续升级目录变动,建议定义个环境变量,这里"MyLibHome"为我定义的环境变量,对应第三方库根目录.
  • 以分号分隔,可以加入常用的protobuf,boost,ice等的include,lib目录
    • Microsoft.Cpp.Win32.user.props 文件
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ExecutablePath>$(VSInstallDir)\SDK\v2.0\bin;$(ExecutablePath)</ExecutablePath>
    <IncludePath>$(MyLibHome)\libevent\include;$(MyLibHome)\protobuf\include;$(MyLibHome)\boost\include;$(MyLibHome)\ice\include;$(IncludePath)</IncludePath>
    <ReferencePath>$(ReferencePath)</ReferencePath>
    <LibraryPath>$(MyLibHome)\libevent\lib;$(MyLibHome)\protobuf\lib;$(MyLibHome)\boost\lib;$(MyLibHome)\ice\lib;$(LibraryPath)</LibraryPath>
    <SourcePath>$(SourcePath)</SourcePath>
    <ExcludePath>$(ExcludePath)</ExcludePath>
  </PropertyGroup>
</Project>
    • Microsoft.Cpp.x64.user.props 文件
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ExecutablePath>$(ExecutablePath)</ExecutablePath>
    <IncludePath>$(MyLibHome)\libevent\include;$(MyLibHome)\protobuf\include;$(MyLibHome)\boost\include;$(MyLibHome)\ice\include;$(IncludePath)</IncludePath>
    <ReferencePath>$(ReferencePath)</ReferencePath>
    <LibraryPath>$(MyLibHome)\libevent\lib64;$(MyLibHome)\protobuf\lib64;$(MyLibHome)\boost\lib;$(VSInstallDir)SDK\v2.0\lib\amd64;$(LibraryPath)</LibraryPath>
    <SourcePath>$(SourcePath)</SourcePath>
    <ExcludePath>$(ExcludePath)</ExcludePath>
  </PropertyGroup>
</Project>


调试时显示utf8字符串

默认的, VC调试器只能正常显示ANSI字符串及UNICODE字符串, 而UTF-8字符串及其他格式则无法显示
这里无需编写插件及修改配置文件,只需要将要显示的字符串拉到Watch中,并在变量后面添加,s8即可显示

同样类型的功能也应该很熟悉

  • var,s8 以utf8显示字符串
  • var,数字 将变量拆分为数组显示, 数字是要显示多少位, 此法对const char*这类原始字符串非常有用
  • var,x 16进制查看
  • var,hr 查看Windows HRESULT解释
  • var,wm Windows消息,例如0x0010, wm 显示 WM_CLOSE


参见