title: How can I build this simple C++/SWIG/C# project in Visual Studio 2010?
body: <p>I need help setting up a simple C++/C# SWIG project.  I am having a hard time putting together a C++ project that uses the SWIG bindings.  I'm using Visual Studio 2010 and the most recent version of SWIG.</p>
  
  <p>My code is simply:</p>
  
  <p><strong>cpp_file.h:</strong></p>
  
  <pre><code>#pragma once
  class cpp_file
  {
  public:
      cpp_file(void);
      ~cpp_file(void);
  
      int times2(int arg);
  };
  </code></pre>
  
  <p><strong>cpp_file.cpp</strong></p>
  
  <pre><code>#include "cpp_file.h"
  cpp_file::cpp_file(void)
  {
  }
  cpp_file::~cpp_file(void)
  {
  }
  int cpp_file::times2(int arg)
  {
  return arg * 2;
  }
  </code></pre>
  
  <p>And my SWIG interface file is:</p>
  
  <p><strong>cpp_file.i</strong></p>
  
  <pre><code>/* cpp_file.i */
  %module cpp_file
  %{
  /* Put header files here or function declarations like below */
  extern int times2(int arg);
  %}
  extern int times2(int arg);
  </code></pre>
  
  <p>I can compile this project fine.  I then run the SWIG command to generate the wrapper:</p>
  
  <pre><code>swig -csharp "C:/pathToFile/cpp_file.i"
  </code></pre>
  
  <p>I don't know what to do at this point.  I can't find any tutorials or documentation that explains what to do in Visual Studio 2010.</p>
  
  <p>When I add the *cpp_file_wrap.c* file that SWIG generates to my Visual Studio 2010 project and attempt to build the project, I get two linker errors.</p>
  
  <ol>
  <li>error LNK1120: 1 unresolved externals</li>
  <li>error LNK2001: unresolved external symbol _times2</li>
  </ol>
  
  <p>The first error message points to my dll file.  The second error points to some object file (*.obj).  The symbol that the error message mentions "_times2" is no where to be found in my project.</p>
  
  <p>How can I move forward with my simple project?  Is there some tutorial or some documentation that explains this process step-by-step?  I can't find anything that involves C++ with SWIG, C#, Visual Studio 2010, and .Net v4.0.</p>