1.问题描述
最近做项目的时候需要在多个cpp文件之间通过全局变量传递参数,因此写了一个小程序来尝试一下。
2.解决方法
一共用到5个文件:test1.h, test1.cpp test2.h test2.cpp main.cpp
test1.h
#ifndef TEST1_H
#define TEST1_H
#include <iostream>
#include <string>
#include <vector>
extern int global_v;
void modify_1();
void print_1();
#endif
test1.cpp
#include "test1.h"
using