当前位置:   article > 正文

libevent-2.0.22-stable在windows环境下使用mingw编译

mingw64 libevent

(0)环境

操作系统:WIN7 SP1 x64

mingw:gcc version 4.9.2 (i686-posix-dwarf-rev1, Built by MinGW-W64 project)

libevent:libevent-2.0.22-stable

(1)修改配置文件

修改libevent源码目录下的WIN32-Code/event2/event-config.h文件,添加#define _EVENT_HAVE_STRTOK_R 1

(2)创建Makefile文件

在libevent源码目录下新建文件Makefile.mingw,内容如下(注意需要按照Makefile的格式自己处理一下空格和Tab缩进):

  1. SRCS = $(wildcard *.c)
  2. OBJS = $(patsubst %.c, %.o, $(SRCS))
  3. CFLAGS = -Wall -c
  4. INCLUDES = -I. -I./include -I./WIN32-Code -I./compat
  5. CC = gcc
  6. AR = ar
  7. CORE_OBJS=event.o buffer.o bufferevent.o bufferevent_sock.o \
  8. bufferevent_pair.o listener.o evmap.o log.o evutil.o \
  9. strlcpy.o signal.o bufferevent_filter.o evthread.o \
  10. bufferevent_ratelim.o evutil_rand.o
  11. WIN_OBJS=win32select.o evthread_win32.o buffer_iocp.o \
  12. event_iocp.o bufferevent_asyn
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/923342
推荐阅读
相关标签
  

闽ICP备14008679号