From 0d9b97199f07adb7cdf768101aac2bf1e11679d8 Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Thu, 7 Sep 2023 21:35:48 -0700 Subject: [PATCH] Remove unnecessary headers from strutil.cpp causing build trouble (#3976) While testing out the 2.5 beta for use in Blender, I hit an odd build error[1] apparently related to include order. Apparently `windows.h` should be included before `shellapi.h`[2]. Swapping the order does fix things, however, it turns out neither is used in this particular file so just remove them both. Unsure why we didn't see it until now. [1] ``` 20>[9/146] Building CXX object src\libutil\CMakeFiles\OpenImageIO_Util.dir\strutil.cpp.obj 20>FAILED: src/libutil/CMakeFiles/OpenImageIO_Util.dir/strutil.cpp.obj 20>cl : Command line warning D9002: ignoring unknown option '/arch:sse2' 20>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shellapi.h(68): error C2146: syntax error: missing ';' before identifier 'DECLSPEC_IMPORT' 20>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shellapi.h(79): error C2065: 'HDROP': undeclared identifier 20>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shellapi.h(82): error C2086: 'int EXTERN_C': redefinition 20>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shellapi.h(68): note: see declaration of 'EXTERN_C' ``` [2] https://stackoverflow.com/questions/2953704/vs2010-lots-of-errors-when-including-standard-libraries https://social.msdn.microsoft.com/forums/vstudio/en-us/ed93ae48-969a-4280-8fd5-ef57a332022b/problems-with-shellexecute-and-shellapih?forum=vcgeneral ## Checklist: - [X] I have read the [contribution guidelines](https://github.com/OpenImageIO/oiio/blob/master/CONTRIBUTING.md). - [ ] I have updated the documentation, if applicable. - [ ] I have ensured that the change is tested somewhere in the testsuite (adding new test cases if necessary). - [ ] If I added or modified a C++ API call, I have also amended the corresponding Python bindings (and if altering ImageBufAlgo functions, also exposed the new functionality as oiiotool options). - [X] My code follows the prevailing code style of this project. If I haven't already run clang-format before submitting, I definitely will look at the CI test that runs clang-format and fix anything that it highlights as being nonconforming. Signed-off-by: Jesse Yurkovich --- src/libutil/strutil.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/libutil/strutil.cpp b/src/libutil/strutil.cpp index 0f2d824893..d7e2f1bbaa 100644 --- a/src/libutil/strutil.cpp +++ b/src/libutil/strutil.cpp @@ -31,11 +31,6 @@ #include #include -#ifdef _WIN32 -# include -# include -#endif - // We use the public domain stb implementation of vsnprintf because // not all platforms support a locale-independent version of vsnprintf.