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