eidheim / Simple-WebSocket-Server

A very simple, fast, multithreaded, platform independent WebSocket (WS) and WebSocket Secure (WSS) server and client library implemented using C++11, Boost.Asio and OpenSSL. Created to be an easy way to make WebSocket endpoints in C++.
MIT License
800 stars 278 forks source link

fatal error C1083: Cannot open include file : 'pthread.h': No such file or directory #89

Open hinhmd opened 6 years ago

hinhmd commented 6 years ago

Hi, I build with cmake on windows and VS 2015, and I got the error. Here is the error log:

Determining if the include file pthread.h exists failed with the following output:
Change Dir: E:/Simple-WebSocket-Server-master/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_af974.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine version 14.0.25420.1

Copyright (C) Microsoft Corporation. All rights reserved.

Build started 29/11/2017 5:01:37 CH.

Project "E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\cmTC_af974.vcxproj" on node 1 (default targets).

PrepareForBuild:

  Creating directory "cmTC_af974.dir\Debug\".

  Creating directory "E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\Debug\".

  Creating directory "cmTC_af974.dir\Debug\cmTC_af974.tlog\".

InitializeBuildStatus:

  Creating "cmTC_af974.dir\Debug\cmTC_af974.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.

ClCompile:

  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_af974.dir\Debug\\" /Fd"cmTC_af974.dir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c"

  Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x86

  Copyright (C) Microsoft Corporation.  All rights reserved.

  cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_af974.dir\Debug\\" /Fd"cmTC_af974.dir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c"

  CheckIncludeFile.c

E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory [E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\cmTC_af974.vcxproj]

Done Building Project "E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\cmTC_af974.vcxproj" (default targets) -- FAILED.

Build FAILED.

"E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\cmTC_af974.vcxproj" (default target) (1) ->

(ClCompile target) -> 

  E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory [E:\Simple-WebSocket-Server-master\build\CMakeFiles\CMakeTmp\cmTC_af974.vcxproj]

    0 Warning(s)

    1 Error(s)

Time Elapsed 00:00:00.82

How can I fix it?

eidheim commented 6 years ago

Sorry, I have never used MSVC. To me it sounds like it fails at this line: find_package(Threads REQUIRED) in CMakeLists.txt. I guess it could also be that your boost is build for pthreads instead of windows-threads? Hopefully, someone who knows Windows can answer this better than me:)