美文网首页
VS使用预编译头

VS使用预编译头

作者: downdemo | 来源:发表于2019-01-23 14:15 被阅读5次
  • 给项目添加一个stdafx.h和stdafx.cpp
  • 在stdafx.h中添加所有需要的头文件,如
#include <vector>
#include <string>
  • stdafx.cpp只需要包含stdafx.h
#include "stdafx.h"
  • 打开项目属性,将配置属性 - C/C++ - 预编译头 - 预编译头改为使用
  • 打开stdafx.cpp属性,将配置属性 - C/C++ - 预编译头 - 预编译头改为创建
预编译头设置
  • 在其他源文件中包含stdafx.h即可使用
// file "test.cpp"
#include "stdafx.h" // 相当于在test.h中包含了stdafx.h中的所有头文件

相关文章

网友评论

      本文标题:VS使用预编译头

      本文链接:https://www.haomeiwen.com/subject/wybjjqtx.html