In file1.cc I write

```
int i = 0;

```

while in file2.cc I write 

```
#include <iostream>

int i = 1;

int main()
{
  std::cout<< i << std::endl;
  return 0;
}

```

In MacOS the compiler reports

```
duplicate symbol _i in:
/var/folders/wn/q9648wb507j9l504vp2d_dwm0000gn/T/file1-bb8eca.o
/var/folders/wn/q9648wb507j9l504vp2d_dwm0000gn/T/file2-b5e667.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

```

But isn't it that different files have their different scopes, so that we can define a global variable in file2 with the same name as in file1?
Moreover, if different files are in the same scope, then why is it illegal to transform file2.cc as:

```
#include <iostream>

int main()
{
  std::cout<< i <<std::endl;
  return 0;
}

```