Search code examples
c++jsoncpp

How to avoid conflict in two header file c++


I am using two lib jsoncpp and imap (lib c-client).

json cpp have write function . but in imap lib they have some macro #define write safe_write which is overriding some macro from jsoncpp . I am not able to use both library at same time. how can I avoid this conflict ?


Solution

  • Assuming you don't use write macro from imap:

    #include "imap.h"
    #undef write
    #include "jsoncpp.h"