title: How to define functions and data from another namespace, not in the global one?
body: <p>Like if I have a header with some declarations:</p>
  
  <p>"Header.hpp"</p>
  
  <pre><code>extern int SomeData;
  
  int SomeFunc();
  </code></pre>
  
  <p>And an Implementation of it (in which I declare all the functions and global variables in an unnamed namespace in order to avoid linkage problems):</p>
  
  <p>"Header.cpp"</p>
  
  <pre><code>#include "Header.hpp"
  
  inline namespace
  {
      const int SomeLocalFileData = 9;
  
      struct MyLocalStructure;
  
      int SomeLocalFunction(MyLocalStructure *);
  
      int ::SomeData(SomeLocalFileData);
  
      int ::SomeFunc()
      {
          return SomeLocalFunction(nullptr);
      }
  }
  </code></pre>
  
  <p>The above code will fail with the following errors (using 'gcc' compiler):</p>
  
  <blockquote>
    <p>error: declaration of 'SomeData' not in a namespace surrounding '::'
             int ::SomeData(SomeLocalFileData);</p>
    
    <p>error: declaration of 'int SomeFunc()' not in a namespace surrounding
    '::'
             int ::SomeFunc()</p>
  </blockquote>
  
  <p>So Is there anyway I can declare all my local file symbols to be in an anonymous namespace, in order to avoid linkage problems but in the same time to be able to define my function and data exports.</p>