As some of you may remember, near and far used to have significance as keywords on the segmented x86 architecture. They remain in as empty macros.
Enter: me. I want to make a frustum class with near and far members. Unfortunately, when is in view, my members get hit by the preprocessor. What do I do?
One option is to change the member names. If the members are public, this results in a frustum class with a non-obvious interface.
GCC provides an alternate solution: #include_next. It works like this:
- Create a special header in a subdirectory of your project tree. I use "src/extern/windows.h".
#pragma GCC system_header#ifndef page_extern_windows_inc#define page_extern_windows_inc#include_next #undef far#undef near#endif
- Add -Isrc/extern to your CFLAGS.
I don't actually include windows.h myself, so it must be something from SDL. Ugh.