hi,
i have confusion regarding access of global variables and functions. i know that global variable can only be accessed with extern syntax but function can be accessed from anywhere declaring its prototype. why global variable can't have a prototype? what is the process behind compiler which restricts from declaring global variables like we do with functions.

Code:
//file1.cpp
#include<iostream>
printHello();
int testInteger;
int main(){
printHello();
std::cout<<testInteger<<std::endl;

}
Code:
//file2.cpp
#include<iostream>
int testInteger=34;
printHello(){
std::cout<<testInteger<<std::endl;
}

in above two translation unit. i know we must use extern to use testInteger in file1 from file2. BUT why declaration of testInteger in file1 and definition in file2 restricted? why we can't do like above code? we can declare functions multiple times and define it once in any translation unit.
what is difference? i know we will get multiple definition error but why it happens? is declaration of integer itself is the definition of that integer?
please illustrate this explaining the process the compiler and linker works with function of this declaration and definition of functions and global variables.