title: How to build a C++ project using mongoose in Visual Studio 2015
body: <p>I try to build a C++ project using <a href="https://docs.cesanta.com/mongoose/latest/" rel="nofollow noreferrer"><strong>mongoose</strong></a>, but I keep getting linker errors.  </p>
  
  <p>I tried to use the answer to the existing SO question describing similar symptoms: <a href="https://stackoverflow.com/a/12573818/3723423">What is an undefined reference/unresolved external symbol error and how do I fix it?</a> by <code>#include</code> C header using external C linkage:   </p>
  
  <pre><code>//simple_web_server credited to Cesanta Software
  #include "stdafx.h"
  
  extern "C" {
  #include "mongoose.h"
  }  
  
  static const char *s_http_port = "8000";
  static struct mg_serve_http_opts s_http_server_opts;
  
  static void ev_handler(struct mg_connection *nc, int ev, void *p) { 
     if (ev == MG_EV_HTTP_REQUEST) {
        mg_serve_http(nc, (struct http_message *) p, s_http_server_opts);
     }
  }
  
  int main(void) {
      struct mg_mgr mgr;
      struct mg_connection *nc;
  
      mg_mgr_init(&amp;mgr, NULL);    // &lt;== this causes linker error
      ...
  </code></pre>
  
  <p>I keep getting the following linker error:</p>
  
  <pre><code>1&gt;------ Build started: Project: simple_web_server02, Configuration: Debug Win32 ------
  1&gt;  simple_web_server02.cpp
  1&gt;simple_web_server02.obj : error LNK2019: unresolved external symbol _mg_mgr_init referenced in function _main
  </code></pre>
  
  <p>The location of <strong><code>mongoose.h</code></strong> is supplied properties > VC++ > Include Directories. </p>
  
  <p>I note also that omitting/including the 'extern "C" {...}' has no apparent effect. </p>
  
  <p>Any help or suggestions would be much appreciated.</p>