serge1 / ELFIO

ELFIO - ELF (Executable and Linkable Format) reader and producer implemented as a header only C++ library
http://serge1.github.io/ELFIO
MIT License
706 stars 152 forks source link

Compilation error if including after <Windows.h> #95

Closed ThirteenAG closed 2 years ago

ThirteenAG commented 2 years ago

Hey, wondering if something can be done about that, this piece of code compiles fine:

#include <elfio/elfio.hpp>
#include <Windows.h>

void test()
{
}

But this one doesn't:

#include <Windows.h>
#include <elfio/elfio.hpp>

void test()
{
}
elfio_section.hpp(214,59): warning C4003: not enough arguments for function-like macro invocation 'max'
elfio_section.hpp(214,59): error C2589: '(': illegal token on right side of '::'

image

serge1 commented 2 years ago

Hi, The question is not directly related to the ELFIO library. Anyway, to prevent Windows.h min/max macros, you may use #define NOMINMAX definition prior including the header file