Question: Sorry guys I know my english is bad, but i made examples so that my question is more clearer.  

**a.cpp**  

```
#include <iostream>

using namespace std;

void funcfoo(){
    cout << "test only" << endl;
}

int varfoo = 10;

```

**b.cpp**

```
#include <iostream>

using namespace std;

extern void funcfoo();

extern int varfoo;

int main(){

    funcfoo();

    cout << varfoo;

    return 0;
}

```

**Then I compile it like this "cl b.cpp a.cpp"**  

My question is. How come when I remove the "extern keyword before void funcfoo()" it works fine, but when i remove the extern keyword
before int var foo I get an error?

Answer: 
When you remove the `extern` from `extern void funcfoo();` you are forward declaring it so you're code below will know what `funcfoo()` is. If you were to do that to a variable, you would actually be instantiating it and would conflict with your other file. Hence the `extern` is saying "it exists, trust me ;)" that it gets resolved from your other file.
Another way to think about it is that when you do int varfoo memory is allocated to hold the variable so it is both a definition and a declaration, when you do int foo() the function is declared but not defined so in a way the memory is not allocated. For functions the linkage is external by default so removing it doesn't matter but for the variable, if you say extern int varfoo the compiler will not allocate memory for it --it will assume that the variable is defined somewhere else.