title: Type Redefinition Error (using Header Guards)
body: <p>Disclaimer: <a href="https://stackoverflow.com/questions/1372480/c-redefinition-header-files-winsock2-h">C++ Redefinition Header Files (winsock2.h)</a> doesnt solved my problem</p>
  
  <p>In this project, im trying to take a screenshot and then compressing it with libjpeg-turbo. The problem is that i get errors like</p>
  
  <pre><code>"sockaddr": "struct" Type redefinition
  </code></pre>
  
  <p>and </p>
  
  <pre><code>"nothl": Redefinition
  </code></pre>
  
  <p>ScreenWorker.h:</p>
  
  <pre><code>#pragma once
  #ifndef SCREENWORKER_H
  #define SCREENWORKER_H
  
  #include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;thread&gt;
  
  #include &lt;turbojpeg.h&gt;
  
  #include &lt;Windows.h&gt;
  
  #include "..\API\NetClient.h"
  
  
  class ScreenWorker {
  private:
      NetClient* client;
  public:
      int delay = 30;
      ScreenWorker(NetClient* client);
      HBITMAP GetScreenBmp(HDC hdc);
      void Update();
  };
  #endif
  </code></pre>
  
  <p>ScreenWorker.cpp:</p>
  
  <pre><code>#include "ScreenWorker.h"
  
  ScreenWorker::ScreenWorker(NetClient* client) {
      this-&gt;client = client;
      Update();
  }
  
  HBITMAP ScreenWorker::GetScreenBmp(HDC hdc) {...}
  
  void ScreenWorker::Update() {...}
  </code></pre>
  
  <p>The main.cpp (DLL-Entry):</p>
  
  <pre><code>#pragma once
  #include "..\..\Base\API\API\GladOSClient.h"
  #include "ScreenWorker.h"
  
  using namespace std;
  
  BOOL WINAPI DllMain(HINSTANCE Instance, DWORD Reason, LPVOID Reserved) {
      return true;
  }
  </code></pre>
  
  <p>NetClient.h (only Header part):</p>
  
  <pre><code>#pragma once
  #ifndef NETCLIENT_H
  #define NETCLIENT_H
  
  #define _WINSOCKAPI_
  #include &lt;Windows.h&gt;
  #include &lt;winsock2.h&gt;
  #include &lt;ws2tcpip.h&gt;
  #include &lt;vector&gt;
  #include &lt;list&gt;
  #include &lt;mutex&gt;
  #include &lt;map&gt;
  #include &lt;string&gt;
  
  #pragma comment (lib, "Ws2_32.lib")
  #pragma comment (lib, "Mswsock.lib")
  #pragma comment (lib, "AdvApi32.lib")
  
  #include "Utils.h"
  #include "PacketHandler.h"
  #include "Packet.h"
  
  ...
  
  #endif
  </code></pre>
  
  <p>As you can see, i'm using header-guards everywhere, but nevertheless i get those errors. Seems like there is a problem with the including of "Windows.h"?</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Edit</strong>
  I guess the problem has something to do with the way libjpegturbo handles the including of "Windows.h". Currently i have no real way of solving this issue. Maybe im trying exporting the function i need in a seperated DLL... hopefully this will solve it.</p>