[Libwebsockets] Compiling in Visual Studio

FNA aqiruse at gmail.com
Thu Feb 28 22:33:33 CET 2013


In regards to:
tag name         v1.22-chrome26-firefox18
Tagged object  commit
c2bb3dc7b3...<http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/commit/?id=c2bb3dc7b399c321123ad98bbfc77c857f35998e>
download
libwebsockets-1.22-chrome26-firefox18.tar.gz<http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/snapshot/libwebsockets-1.22-chrome26-firefox18.tar.gz>

I have used the CMake file to generate my project files for Visual Studio
2008. The CMake works great. However, there are two issues. One issue is
with the paths that the generated project files have set by CMake. They
specify lib\Debug\websockets_static.lib as the library location but the
test projects are unable to find that path. Simple fix by adding my project
dir to before the lib, I do not mind manually doing that.

Secondly, which is a problem is located in the server.c file on line 221.
The line reads:

if (errno == EAGAIN || errno == EWOULDBLOCK) {


EWOULDBLOCK is not defined and not known for Visual Studio. Therefore in
order to provide a fix for this, it is simply at the top of the file in the
defines, change the defines for WIN32 in server.c to read:


#ifdef WIN32
#include <tchar.h>
#include <io.h>
#if _MSC_VER > 1000 //add this
#define EWOULDBLOCK WSAEWOULDBLOCK //Add this to work with MS Visual Studio
#endif //end of _MSC_VER
#else

Apart from that it compiles fine. I have not tested it yet, but it is a
stable version so I am sure it will work fine as well.

-- 
--A programmer started to cuss
--Because getting to sleep was a fuss
--As he lay there in bed
--Looping 'round in his head
--was: while( !asleep() ) sheep++;
--Nothing is impossible! It is merely a matter of figuring out How?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20130228/4afece50/attachment-0001.html>


More information about the Libwebsockets mailing list