Problem compiling lib_ev on windows

Eric Fowler eric.fowler at
Tue Apr 5 21:25:20 CEST 2016

I am porting some Linux code containing libev to windows, and have run into a mysterious compilation issue.

The problem is manifested by a syntax error (repeated hundreds of times) in ev_vars.h:

#define VARx(type,name) VAR(name, type name)

VARx(ev_tstamp, now_floor)  // <<<<<< THIS CHOKES: "Error: expected a ')' "

VAR is defined in ev.c thusly:

struct ev_loop
    ev_tstamp ev_rt_now;
    #define ev_rt_now ((loop)->ev_rt_now)
    #define VAR(name,decl) decl;
      #include "ev_vars.h"
    #undef VAR

The problem seems to be that VAR is of the form SYMBOL(arg1, arg2 arg1). That space between the parameters (arg2 arg1) confuses MSVC.

It looks like another Microsoft / g++ compiler snag, but I would expect the library creators to have caught it by now, so something else must be wrong.
Working around this is certainly possible, but others who compile on Windows must have seen it, and I want to know if I have committed a more fundamental and grievous error in my handling of libev.

Is this error familiar to anyone?



The information in this email, and any attachments, may contain confidential information and is intended solely for the attention and use of the named addressee(s). It must not be disclosed to any person(s) without authorization. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are not authorized to, and must not, disclose, copy, distribute, or retain this message or any part of it. If you have received this communication in error, please notify me immediately.

More information about the libev mailing list