How do I avoid name collision with macros defined in Windows header files?

后端 未结 8 1357
一向
一向 2020-12-10 11:24

I have some C++ code that includes a method called CreateDirectory(). Previously the code only used STL and Boost, but I recently had to include

8条回答
  •  北海茫月
    2020-12-10 11:41

    You could create a module whose sole purpose is to #include and look up CSIDL_LOCAL_APPDATA wrapped in a function.

    int get_CSIDL_LOCAL_APPDATA(void)
    {
        return CSIDL_LOCAL_APPDATA;
    }
    

    btw, Well done for working out what happened!

提交回复
热议问题