关于算法源代码中头文件myhead的问题和如何在VS2010中加入自己的头文件的问题

我的每个算法源代码的头文件都是

#include <myhead.h>

是在VS2010中设置的将自己的头文件加入了加入了系统默认头文件库,源文件为

// myhead.h

#ifndef _MYHEAP_H_
#define _MYHEAP_H_

#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <fstream>
#include <iomanip>
#include <bitset>
#include <list>
#include <climits>
#include <ctime>
#include <functional>
#include <iterator>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
//typedef __int64 _I64;          //此类型只能在C++中使用,G++不支持此类型
#define CC(m,what)		memset(m,what,sizeof(m))
#define FOR(i,a,b)		for( int i = (a) ; i < (b) ; i ++ )
#define FF(i,a)			for( int i = 0 ; i < (a) ; i ++ )
#define FFD(i,a)		for( int i = (a)-1 ; i >= 0 ; i --)
#define SS(a)			scanf("%d",&a)
#define PARENT(a)		((a)>>1)
#define LL(a)			((a)<<1)
#define RR(a)			(((a)<<1)|1)
#define MID(a,b)		(((a)+(b))>>1)
#define SZ(a)			((int)a.size())
#define PP(n,m,a)		puts("---");FF(i,n){FF(j,m)cout << a[i][j] << ' ';puts("");}
#define LSON			l,mid,LL(rt)
#define RSON			mid+1,r,RR(rt)
const double eps = 1e-11;
const double Pi = acos(-1.0);
#define read			freopen("in.txt","r",stdin)
#define write			freopen("out.txt","w",stdout)
#define two(x)			((LL)1<<(x))
#define include(a,b)		(((a)&(b))==(b))
template<class T> inline T countbit(T n)	{return n?1+countbit(n&(n-1)):0;}
template<class T> inline T sqr(T a)	{return a*a;}
template<class T> inline void checkmin(T &a,T b)	{if(a == -1 || a > b) a = b;}
template<class T> inline void checkmax(T &a,T b)	{if(a < b)	a = b;}
const int dx[] = {-1,0,1,0};//up Right down Left
const int dy[] = {0,1,0,-1};
const int dxy[8][2]={{-1,-1},{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1}};
const int bxy[8][2]={{-1,-2},{-1,2},{-2,1},{-2,-1},{1,2},{1,-2},{2,1},{2,-1}};


#endif

这样就省去了引入各种头文件和一些常用小函数还要自己写烦恼.

那么如何引入呢?


在VS2010新建项目一个C++空项目后,单击项目.

选择项目名+属性:


在配置属性里的 VC++目录中:

选择包含目录:

点编辑后:

在输入框中输入要包含文件的路径即可:


这样就可以吧自己的头文件放进默认系统库里(具体就是用 '<' 调用头文件,而不是用双引号),如果用双引号每次就得每次都复制这个文件到工程目录下:



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值