extern linkage

pre C++ 17 inline function https://stackoverflow.com/questions/38043442/how-do-inline-variables-work C++ 17 inline variable https://en.cppreference.com/w/cpp/language/inline

extern和 class static 使用inline在.h头文件中进行定义

struct MyStruct
{
	static std::string name_;
}

//inline define
inline std::string MyStruct::name_;

代替extern关键字需要.cpp中进行定义,采用inline在头文件定义

inline int var = 1; //extern linkage