title: Unresolved external symbols in protected: "void __thiscall cocos2d::Console::loop(void)"
body: <p>I download SDK from official site, and create new project with following commands:</p>
  
  <pre><code>cocos new foo -p com.foo.bar -l cpp -d .
  </code></pre>
  
  <p>So, new project <code>foo</code> created and I enter its directory.
  I know <code>proj.win32</code> has solution files for visual studio prebuilt in it. But I want regenerate them from <code>CMakeLists.txt</code> at root project directory.</p>
  
  <p>So I <code>mkdir -p cmake-out/vs2012</code>, enter directory , and <code>cmake -G "Visual Studio 11 2012" ../../</code>.
  Everything's fine, solution files are built by cmake, so I rebuilt whole solution in visual studio.
  Compilation all passed*, but final link process is fail because following errors:</p>
  
  <pre><code>4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '___WSAFDIsSet@8' referenced in function '"protected: void __thiscall cocos2d::Console::loop(void)" (?loop@Console@cocos2d@@IAEXXZ)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__accept@12' referenced in function '"protected: void __thiscall cocos2d::Console::addClient(void)" (?addClient@Console@cocos2d@@IAEXXZ)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__bind@12' referenced in function '"public: bool __thiscall cocos2d::Console::listenOnTCP(int)" (?listenOnTCP@Console@cocos2d@@QAE_NH@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__closesocket@4' referenced in function '"protected: void __thiscall cocos2d::Console::commandExit(int,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;)" (?commandExit@Console@cocos2d@@IAEXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__ioctlsocket@12' referenced in function '"protected: void __thiscall cocos2d::Console::loop(void)" (?loop@Console@cocos2d@@IAEXXZ)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__listen@8' referenced in function '"public: bool __thiscall cocos2d::Console::listenOnTCP(int)" (?listenOnTCP@Console@cocos2d@@QAE_NH@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__ntohs@4' referenced in function '"public: bool __thiscall cocos2d::Console::listenOnTCP(int)" (?listenOnTCP@Console@cocos2d@@QAE_NH@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__recv@16' referenced in function '"protected: void __thiscall cocos2d::Console::commandUpload(int)" (?commandUpload@Console@cocos2d@@IAEXH@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__select@20' referenced in function '"protected: void __thiscall cocos2d::Console::loop(void)" (?loop@Console@cocos2d@@IAEXXZ)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__send@16' referenced in function '"public: void __thiscall &lt;lambda_18a69eabc233d9cfc5fb2fb65c07cfe6&gt;::operator()(void)const " (??R&lt;lambda_18a69eabc233d9cfc5fb2fb65c07cfe6&gt;@@QBEXXZ)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__setsockopt@20' referenced in function '"public: bool __thiscall cocos2d::Console::listenOnTCP(int)" (?listenOnTCP@Console@cocos2d@@QAE_NH@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__socket@12' referenced in function '"public: bool __thiscall cocos2d::Console::listenOnTCP(int)" (?listenOnTCP@Console@cocos2d@@QAE_NH@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__WSAStartup@8' referenced in function '"public: bool __thiscall cocos2d::Console::listenOnTCP(int)" (?listenOnTCP@Console@cocos2d@@QAE_NH@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__WSACleanup@0' referenced in function '"protected: void __thiscall cocos2d::Console::loop(void)" (?loop@Console@cocos2d@@IAEXXZ)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__getaddrinfo@16' referenced in function '"public: bool __thiscall cocos2d::Console::listenOnTCP(int)" (?listenOnTCP@Console@cocos2d@@QAE_NH@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '__imp__freeaddrinfo@4' referenced in function '"public: bool __thiscall cocos2d::Console::listenOnTCP(int)" (?listenOnTCP@Console@cocos2d@@QAE_NH@Z)'
  4&gt;cocos2d.lib(CCConsole.obj) : error LNK2019: unresolved external symbol '_inet_ntop@16' referenced in function '"public: bool __thiscall cocos2d::Console::listenOnTCP(int)" (?listenOnTCP@Console@cocos2d@@QAE_NH@Z)'
  </code></pre>
  
  <p>Original solution have no errors, I know. But visual studio solution files should be able to generated by cmake, What problem with <code>CMakeLists.txt</code> ?</p>
  
  <hr>
  
  <p>*: In fact, include directories settings aren't correct, so I patch them:</p>
  
  <pre><code>include_directories(
      ${CMAKE_CURRENT_SOURCE_DIR}/Classes
      ${COCOS2D_ROOT}
      ${COCOS2D_ROOT}/cocos
      ${COCOS2D_ROOT}/cocos/audio/include
      ${COCOS2D_ROOT}/cocos/2d
      ${COCOS2D_ROOT}/cocos/2d/renderer
      ${COCOS2D_ROOT}/cocos/2d/platform
      ${COCOS2D_ROOT}/cocos/2d/platform/desktop
      ${COCOS2D_ROOT}/cocos/2d/platform/win32
      ${COCOS2D_ROOT}/cocos/base
  </code></pre>
  
  <p>with them:</p>
  
  <pre><code>include_directories(
      ${CMAKE_CURRENT_SOURCE_DIR}/Classes
      ${COCOS2D_ROOT}
      ${COCOS2D_ROOT}/cocos
      ${COCOS2D_ROOT}/cocos/audio/include
      ${COCOS2D_ROOT}/cocos/2d
      ${COCOS2D_ROOT}/cocos/renderer
      ${COCOS2D_ROOT}/cocos/platform
      ${COCOS2D_ROOT}/cocos/platform/desktop
      ${COCOS2D_ROOT}/cocos/platform/win32
      ${COCOS2D_ROOT}/cocos/base
  </code></pre>
  
  <p>Yes, <code>renderer</code>,<code>platform</code>... not in <code>cocos/2d</code> path.
  That's the only change I must do to the sources.</p>