title: Creating a DLL from a wrapped cpp file with SWIG
body: <p>I am in the process of learning how to use SWIG on Windows. </p>
  
  <p>The following is my c++ code:</p>
  
  <pre><code> /* File : example.cxx */
  
   #include "example.h"
   #define M_PI 3.14159265358979323846
  
  /* Move the shape to a new location */
  void Shape::move(double dx, double dy) {
      x += dx;
      y += dy;
   }
  
  int Shape::nshapes = 0;
  
  double Circle::area(void) {
     return M_PI*radius*radius;
  }
  
  double Circle::perimeter(void) {
    return 2*M_PI*radius;
  }
  
  double Square::area(void) {
    return width*width;
  }
  
   double Square::perimeter(void) {
     return 4*width;
   }
  </code></pre>
  
  <p>This is my header file:</p>
  
  <pre><code>/* File : example.h */
  
     class Shape {
     public:
       Shape() {
       nshapes++;
     }
    virtual ~Shape() {
     nshapes--;
   };
    double  x, y;   
    void    move(double dx, double dy);
    virtual double area(void) = 0;
    virtual double perimeter(void) = 0;
    static  int nshapes;
    };
  
   class Circle : public Shape {
   private:
     double radius;
   public:
     Circle(double r) : radius(r) { };
     virtual double area(void);
     virtual double perimeter(void);
   };
  
   class Square : public Shape {
   private:
     double width;
   public:
     Square(double w) : width(w) { };
     virtual double area(void);
     virtual double perimeter(void);
   };
  </code></pre>
  
  <p>This is my interface file:</p>
  
  <pre><code> /* File : example.i */
   %module example
  
   %{
   #include "example.h"
   %}
  
   %include "example.h"
  </code></pre>
  
  <p>I have managed to wrap my c++ code with the following command in Cygwin using SWIG:</p>
  
  <pre><code>  $swig -c++ -python -o example_wrap.cpp example.i 
  </code></pre>
  
  <p>My question is, how do I create a DLL from this point forward using the generated code (example_wrap.cpp)? Any ideas? </p>
  
  <p>I tried creating a DLL with Visual Studio C++ 2010 but I get the build error:</p>
  
  <pre><code>LINK : fatal error LNK1104: cannot open file 'python27_d.lib
  </code></pre>
  
  <p>I'm fairly new to using SWIG so any help would be greatly appreciated.</p>
  
  <p>Thanks!</p>