title: How do I set up a multi-project solution in C++?
body: <p>I'm new to C++ and I'm having a hard time getting my dll references to work. I've been trying to get it to work for a couple of days, but the few explainations I've found often refer to doing x or y, but don't tell me <em>how</em> to do x or y. Since I'm not a C++ veteran, I need someone to walk me through it. What I want to do is the following:</p>
  
  <pre><code>MySolution
      MyExe (Win32 .exe)
          Main.h
          Main.cpp
              (constructs ImplementationB calls the methods as defined by InterfaceA, then deletes the instances)
              (calls/fills HelperC.Foobar)
      MyInterfaces (dll)
          InterfaceA.h
              ~InterfaceA();
              virtual void DoSomething();
      MyUtils (dll)
          HelperC.h
              static float Foobar;
          HelperD.cpp
              float HelperC::Foobar = 1.0f;
      MyImplementations (dll)
          ImplementationB : InterfaceA
              (uses the value from HelperC.Foobar)
  </code></pre>
  
  <p>The <code>MyExe</code> and <code>MyImplementations</code> projects contain most of the executing code. But, I need an interface, so I need an interface project (<code>MyInterfaces</code>). I need some helper classes that need to be accessible from both <code>MyExe</code> and <code>MyImplementations</code>, hence <code>MyUtils</code>. I would like this helper class to be statically available, though it is not mandatory.</p>
  
  <p><strong>I had a compiling version before I started adding <code>MyUtils</code> with the <code>HelperC</code> class.</strong> I had to mark the interface destructor with <code>__declspec(dllexport)</code>, along with the <code>DoSomething</code> method. I also had to mark the constructor of <code>ImplementationB</code> in order to instantiate it from <code>MyExe</code>, which makes sense. However, when I tried to mark the entire class (both the implementation and the interface) with <code>__declspec(dllexport)</code>, the example wouldn't compile (which does <em>not</em> make sense).</p>
  
  <p>From what I've read, having static fields in a dll and using them from external code doesn't really work all too well. So, as an alternative, I made <code>Foobar</code> non-static and passed a <code>HelperC</code> instance to the method as described by <code>InterfaceA</code>. Since I had already gotten simple classes to work, I figured that should work as well. However, now the compiler is throwing errors on the constructor of <code>ImplementationB</code> (LNK2019).</p>
  
  <p>In short: I'm getting link errors all over the place in sections that have nothing to do with my changes, and there's little documentation describing the specific steps I need to perform in order to get a simple dll reference to work.<br>
  Can someone point out what I need to add and where I need to add it in order to make it compile? Also, some do's and don't's about C++ dll references would help a lot (e.g. don't use statics across projects).</p>