title: Use C++/CLI Library in C++ native code and how to link
body: <p>I want to use some code that executes a http-post, and because I'm not too familiar with c++ and what libraries you can use, and I am probably too dumb to get libcurl and curlpp to work, I found a link explaining how to use the .net version.</p>
  
  <p>Alright so I created a class. Header File:</p>
  
  <pre><code>public ref class Element
  {
  public:
      Element();
      virtual ~Element();
      void ExecuteCommand();
  };
  </code></pre>
  
  <p>Class file:</p>
  
  <pre><code>#include "Element.h"
  
  
  Element::Element()
  {
  }
  
  
  Element::~Element()
  {
      Console::WriteLine("deletion");
  }
  
  
  void Element::ExecuteCommand(){
      HttpWebRequest^ request = dynamic_cast&lt;HttpWebRequest^&gt;(WebRequest::Create("http://www.google.com"));
  
      request-&gt;MaximumAutomaticRedirections = 4;
      request-&gt;MaximumResponseHeadersLength = 4;
  
      request-&gt;Credentials = gcnew NetworkCredential("username", "password", "domain");
      HttpWebResponse^ response = dynamic_cast&lt;HttpWebResponse^&gt;(request-&gt;GetResponse());
      Console::WriteLine("Content length is {0}", response-&gt;ContentLength);
      Console::WriteLine("Content type is {0}", response-&gt;ContentType);
  
      // Get the stream associated with the response.
      Stream^ receiveStream = response-&gt;GetResponseStream();
  
      // Pipes the stream to a higher level stream reader with the required encoding format. 
      StreamReader^ readStream = gcnew StreamReader(receiveStream, Encoding::UTF8);
      Console::WriteLine("Response stream received.");
      Console::WriteLine(readStream-&gt;ReadToEnd());
      response-&gt;Close();
      readStream-&gt;Close();
  
  }
  </code></pre>
  
  <p>If I set the configuration type of this project to Application (exe), and create a new .cpp file where I create an Instance of this Element it works fine.</p>
  
  <p>But my question is: Is it possible to create a .dll/.lib Library from this project and use it in a C++ project without CLI? (I don't want to use ^ for pointers :( )</p>
  
  <p>Even if it's not possible, I have another problem.
  When I link the library in a C++/CLI project. I get </p>
  
  <pre><code>unresolved token (06000001) Element::.ctor
  unresolved token (06000002) Element::~Element
  unresolved token (06000003) Element::ExecuteCommand
  3 unresolved externals
  </code></pre>
  
  <p>the code for main.cpp in the second project is just the following:</p>
  
  <pre><code>#include &lt;Element.h&gt;
  
  int main(){
      return 0;
  }
  </code></pre>
  
  <p>Thank you</p>