How to use extern global variables in Qt

Declare global variables in any .h file in the Qt project

例:extern int a;

Defined in the first .cpp interface

main.cpp

int a;

intmain(intargc,char*argv[])

{

}


Callable from any function in any .cpp file

Changeable global variable value

Just assign it directly

a=1;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324768911&siteId=291194637