.h头文件的使用方法

1. 宏定义(预处理#define);

2. 结构、联合和枚举声明;

3. typedef声明;

4. 外部函数声明;

5. 全局变量声明。

可以定义在global.h文件中,但记得写extern,然后再在global.c中写一遍,不加extern,如果有赋初值的变量,在global.h中不赋值,在global.c中赋值。

global.h

#ifndef __GLOBAL_H_
#define __GLOBAL_H_

#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <memory.h>
#include <vector>
#include <windows.h>

using namespace std;

#include "random.h"

#define GNEx_nodes 128
#define GNEx_edge 1024
#define GNEx_QR 1.0/(2*GNEx_edge)

#define INF 1.0e+30
#define archive_size 500   /* set capacity of archive */

extern int     numVariables;
extern int     numObjectives;
extern int     popsize;
extern int     niche;
extern int     mt;
extern int     m
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值