Visual studio相关

Contents

  • References
  • 各种配置
  • 外部工具 external tools
      • 添加Monitor
  • 预编译
    • 预编译头
    • precompiling
  • run
  • debug
      • error c1083 : cannot find file XXX.cpp
      • 快捷键紊乱
      • intelisense自动提示没了

References

  1. 官方文档永远最靠谱
  • 你可以选择所使用的语言,e.g. c++。
  • 把http中的“zh-cn”部分去掉就是英文原版。

各种配置

  1. 包含目录、库目录、附加包含目录、附加库目录、附加依赖项之详解

附加依赖项是把库目录下本项目用到的lib文件名加进去。

  • %附加 是指只对当前工程有效%
  • 库目录只是查找目录,具体用哪一个需要指明的,如果不在附加依赖项里填上,就需要在代码里用#pragma comment(lib, “xxx.lib”)来手动指定了。你写代码读写一个文件需要写明文件名吧,这个文件名就相当于那个lib。
  • 像boost中大概自带#pragma comment…之类代码指定了具体所需的库文件,所以不需要配置附加依赖项,而opencv是需要的。

外部工具 external tools

  1. 如何从VS运行外部工具

添加Monitor

  1. 首先你需要安装Source Monitor;

  2. Tools -> external tools , add 一个新的.
    Title: 外部工具名称;
    Command: 外部工具(.exe)文件绝对路径
    Arguments: /DC 文件路径 (可以单击右侧箭头选择) (/DC是c语言, /DC++是cpp)
    Initial directory: 工具工作过程中可能产生一些中间文件,用来存放之.
    不懂的内容 在Monitor的Help手册中详细得很.

    Source Monitor 官网没有文档. 打开软件后点击"Help"即可!

  • Monitor参考文献1

Kiviat 图中的绿色环形区域即被测量维度的期望值,维度上的点则是测量得到的实际值。当一个维度上的点位于绿色环形区域中时表明这个维度的测量结果是符合期望的。

预编译

预编译头

  • a precompiled header file named “pch.h” , early called “stdafx.h”(只能放在源文件最开始, 前面可以有注释)
  • Precompiled code is useful during the development cycle to reduce compilation time(because the stable code does not need to be recompiled.), especially if:
  1. You always use a large body of code that changes infrequently.
  2. Your program comprises multiple modules, all of which use a standard set of include files and the same compilation options. In this case, all include files can be precompiled into one precompiled header.
  • Although you can use only one precompiled header (.pch) file per source file, you can use multiple .pch files in a project.

官方解释,很详细

  • Compiling against a large API like Windows, is a long , slow process.
  • instead of starting from scratch, the compiler starts compiling from the already saved results of compiling everything in stdafx.h.

stackoverflow的回答

  • 预编译头文件不一定叫"pch.h",也可以自己取,关键是新建工程时选择"预编译头",然后默认第一个include file.

gcc 预编译头

precompiling

  1. 关于#pragma once 和 #ifndef
  • #ifndef可以针对一个文件中的部分代码,而#pragma once不支持。特别在书写可移植性代码的时候,比如针对不同平台选择不同的库函数,基本上只能用#ifndef了。还有就是C的头文件中一般有#ifdef __cplusplus等,就不能用#pragma once了。
  • #pragma once 可能有兼容性问题, 且无法识别两个相同文件. 但是速度更快. vs中当然#pragma once.
  • 两种都用可能不好.

#pragma once 和 #ifndef

run

debug

error c1083 : cannot find file XXX.cpp

可能的解决方案:

  1. xxx.cpp这个文件,你还没有把它从项目中排除就先手动删除了它.

快捷键紊乱

注意是否有冲突;
可能指定了多个快捷键,在下拉窗口选中,右侧"移除"Visual studio相关_第1张图片

intelisense自动提示没了

显示没有可用成员.

解决方案:

  • 尝试把文件从项目中排除,然后再包括进来.

你可能感兴趣的:(tools,工具)