title: Class Library - Static Library - Linker Issue LNK4221
body: <p>I am using VS2008, Class Library template, with /clr. 
  I wanted to have a managed Class Library.
  Everything works fine when I have the library compiled as a dll.</p>
  
  <p>Header file: multiclasses.h</p>
  
  <pre><code>#pragma once
  
  namespace multiclasses
  {
      public ref class Class1
      {
      public: int a, b;
      private: int c, d;
      public: int add(int a, int b);
      private: int hadd(int a, int b);
      };
  
      private ref class Class2
      {
      public: int a, b;
      private: int c, d;
      public: int add(int a, int b);
      private: int hadd(int a, int b);
      };
  }
  </code></pre>
  
  <p>Source file: multiclasses.cpp</p>
  
  <pre><code>#include "multiclasses.h"
  
  namespace multiclasses
  {
  
      int Class1::add(int a, int b)
      {
          return a + b;
      }
      int Class1::hadd(int a, int b)
      {
          return a + b;
      }
  
      int Class2::add(int a, int b)
      {
          return a + b;
      }
      int Class2::hadd(int a, int b)
      {
          return a + b;
      }
  }
  </code></pre>
  
  <p>When I change the Configuration Type to Static Library(.lib) I get the linker warning:
  warning</p>
  
  <p><em>warning LNK4221: no public symbols found; archive member will be inaccessible</em></p>
  
  <p>Consequently The project using this library gives:</p>
  
  <p><em>Error  1   error LNK2020: unresolved token (06000001) multiclasses.Class1::add</em></p>
  
  <p><em>Error  2   error LNK2020: unresolved token (06000002) multiclasses.Class1::hadd</em></p>
  
  <p><em>Error  3   error LNK2020: unresolved token (06000004) multiclasses.Class2::add</em></p>
  
  <p><em>Error  4   error LNK2020: unresolved token (06000005) multiclasses.Class2::hadd</em></p>
  
  <p>Is there any way I can have a class library compiled as a static library(.lib) ?<br>
  Can I export classes in a static library? Is that fundamentally wrong trying to export classes in a static library?</p>