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?