These 2 files are only examples representing my problem.
I want to have a variable accessible to all of my .cpp files (and are many!!!)
The problem is that I want to be able to change the value of these variables. Unfortunately the variables are read-only and i get error: assignment of read-only variable āiā
This is logical but if instead of 'const int' I use 'int', then I get error: multiple definition of āiā (not in this specific example, but if I include common.h in some other .cpp file it will say multiple definition.)
So, what I want is to create a variable into common.h that its value can be changed by every .cpp file. 'int' instead of 'const int' cannot be used because of multiple definition error.
The neat thing about extern is that it declares that a variable's actual code is in another object file, but still permits the variable to be known about in other files. So you only need that int i = 1; in one file. :)