global.h
#ifndef _GlobalDB
#define _GlobalDB
#include "Model.h"
#include <map>
using namespace std;
extern map<int,CMPara> tbPara;
#endif
global.cpp
#include "global.h"
#include "stdafx.h"
map<int,CMPara> tbPara;
就这样,其他地方 #include "global.h" 就好了
本文介绍了一个全局配置文件global.h及其对应的实现文件global.cpp的设计方法。该配置文件定义了一个外部全局变量tbPara,类型为int到CMPara的映射,用于存储参数配置。在其他文件中通过包含global.h即可使用这些配置。
438

被折叠的 条评论
为什么被折叠?



