title: The "this declaration has no storage class or type specifier" error in c++
body: <p>I've decided to implement some design patterns in C++ just as an exercise and created a certain project architecture, the thing is that I want my patterns to live inside the <code>patterns</code> directory and in different files. For example <code>SimpleFactoryPattern</code> should be put in the <code>simplefactory.h</code> file. The code looks like this:</p>
  
  <pre><code>class SimpleAutoFactory {
      public:
          SimpleAutoFactory() {};
          ~SimpleAutoFactory() {};
          SharedInterfaces::IAuto *getAutoModel(EModel model) {
              switch (model) {
                  case EModel::EFiat:
                      return new SharedModels::Fiat;
  
                  case EModel::ELamborghini:
                      return new SharedModels::Lamborghini;
  
                  case EModel::EMaserati:
                      return new SharedModels::Maserati;
  
                  default: throw CommonExceptions::unknownModelException;
              }
          }
  };
  </code></pre>
  
  <p>Then I simply include this piece in the main.cpp and run <code>make &amp;&amp; make run</code> to compile and execute the whole thing. The problem is that my linter yields errors saying that it doesn't know where the <code>SharedInterfaces</code> namespace comes from and so on. I suspect there must be something wrong with the structure of the project. 
  I'm sort of new to C++ but as far as I know we only declare things in headers and execute stuff in cpps. If I import, that's, include the required headers in my <code>simplefactory.cpp</code> file I face the redefinition error.
  What is the right way to handle this in C++?</p>