Compiling libevent source code (Windows)

Source: Internet
Author: User

Study notes, just record this success with Libevent source code to compile. The environment is Mingw+vs2008+msys.

0. Download Libevent Library

http://libevent.org/Download the stable stable version of the library.

1. Compiling

At first I compiled it with MinGW, but there was always a problem. Later, referring to this blog: http://m.blog.csdn.net/blog/bojie5744/39698599, the run environment of VS is included, and then compiled

Call "C:\Program Files\Microsoft Visual Studio 9.0\vc\vcvarsall.bat"

./configure; make; make install;

If you do not install it, the Libevent header file is in the include, and the generated library is in. Libs, because it uses the VS operating environment. So the Libevent source code compiles the library suffix to lib, not the previous a file. copy libevent.lib;libevent_core.lib;libevent_extra.lib; (finally give me the compiled file, convenient for people without the VS compilation environment to download the use.) For later convenience, you can copy the files in the Include directory into the development environment's include, while the. Libs three files can also be copied into the MinGW Lib folder.

2.libevent Test Code
1 #include <winsock2.h>2 #include <event2/event.h>3 #include <event2/event_struct.h> 4 5 int main (int a RGC, char **argv) 6 {7     event timeout;8     return (0); 9}

The Compile option is

g++ test.cpp-iinclude-l.-levent-lws2_32

Note that the test compiles or does not pass. To change the Libevent.lib file name to Event.lib can be passed, the specific why is not clear. As for why the Lib Library of Ms System and MinGW's a library file is different, under Windows MinGW Advanced version, the two are no different, can be called to use.

3.libevent comes with the source of the HTTP server(Http-server.c in sample)View Code

g++ http-server.c-iinclude-l.-levent-lws2_32

This can be used as a server.

  

Libevent Compiled library: http://files.cnblogs.com/files/wunaozai/libevent.zip

From:http://www.cnblogs.com/wunaozai/p/4550084.html

Compiling libevent source code (Windows)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.