qhttpengine icon indicating copy to clipboard operation
qhttpengine copied to clipboard

DELETE macro conflict

Open robozman opened this issue 6 years ago • 1 comments

I'm having an issue when compiling a program that uses qhttpengine on Windows. The use of DELETE at https://github.com/nitroshare/qhttpengine/blob/43f55df51623621ed3efb4e42c7894586d988667/src/include/qhttpengine/socket.h#L134 is resolving the DELETE macro that in defined in winnt.h. This is causing the compile to fail with a syntax error.

My current workaround for this is to rename the DELETE in socket.h to something else but this obviously isn't a good solution to the problem.

Thanks for your help and for your software!

robozman avatar Aug 13 '19 01:08 robozman

One possible option (assuming you don't need the DELETE constant from winnt.h) is to add the following line before including socket.h:

#undef DELETE
#include <qhttpengine/socket.h>

As for a long term solution, let me give this some careful thought.

(This is one of the reasons I don't like #defines - it pollutes the global namespace and causes problems like this.)

nathan-osman avatar Aug 14 '19 05:08 nathan-osman