If it is a global variable that is not declared static or inline, then they have external linkage by default.
The problem with your extern declaration is that it is also a definition because you provided an initialisation value. Now since this definition is in a header file, this definition is going to appear across multiple source files (translation units) that include this header file. Defining the same variable more than once in multiple translation units (barring a few exceptions) violates what is known as One Definition Rule (ODR) and will be flagged as an error when it can be detected.
There are ways to get around this.
1. You can not initialize the extern variable in the header and instead initialize it in one and only one source file that includes the header file.
2. You can remove extern and declare the variable as either static (not recommended) or inline
3. You can remove extern and provide the definition within an anonymous namespace in the header file.
Thank you very much!
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
นะวู
Pavel
Void
Jonathan
İbn
N
MᏫᎻᎯᎷᎷᎬᎠ
\Device\NUL
buğra