VC ++ global variables defined

vc define global variables and extern usage:

Global variables are generally defined like this:

1. In a class defined in .cpp int myInt;

Then extern int myInt in .cpp to use in place; so that you can use.

2. Adding stdafx.cpp in:

int myInt;

Then join in the stdafx.h:

extern int myInt

After this definition, no matter what files are visible.

Guess you like

Origin www.cnblogs.com/profession/p/12310795.html