afwbkbc / glsmac

Unofficial open-source OpenGL/SDL2 reimplementation of Sid Meier's Alpha Centauri ( + Alien Crossfire )
GNU Affero General Public License v3.0
400 stars 12 forks source link

[VS-Clang] Compilation error on Mesh.cpp #7

Closed tsunamistate closed 1 year ago

tsunamistate commented 1 year ago

OS: Windows 11 IDE: Visual Studio 2022 17.4.5 Compiler: Clang 15.0.1 Version/commit: bisected to a0db10ba39aee98621a260581be1999e90ae0281

Steps to reproduce:

  1. Open Visual Studio and open glsmac folder with it. Wait until CMake configuration finishes
  2. Use Build ⇒ Build All in top menu or Ctrl+Shift+B shortcut to compile an executable

Actual result:

Compilation fails with the following error:

  [17/74] Building CXX object CMakeFiles/GLSMAC.dir/src/graphics/opengl/actor/Mesh.cpp.obj
  FAILED: CMakeFiles/GLSMAC.dir/src/graphics/opengl/actor/Mesh.cpp.obj 
  C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\Llvm\x64\bin\CLANG_~1.EXE -DGLEW_NO_GLU -DGLEW_STATIC -DVC_EXTRALEAN -DVISUAL_STUDIO -DWIN32_MEAN_AND_LEAN -D_CRT_SECURE_NO_WARNINGS -D_ITERATOR_DEBUG_LEVEL=0 -ID:/src/glsmac/src -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/glew-src/include -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/freetype-build/include -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/freetype-src/include -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/sdl2-build/include -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/sdl2-build/include-config-release -ID:/src/glsmac/out/build/x64-release-win-clang/_deps/sdl_image-src -std=c++17  -s -O3 -march=native -Wno-pointer-arith -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -MD -MT CMakeFiles/GLSMAC.dir/src/graphics/opengl/actor/Mesh.cpp.obj -MF CMakeFiles\GLSMAC.dir\src\graphics\opengl\actor\Mesh.cpp.obj.d -o CMakeFiles/GLSMAC.dir/src/graphics/opengl/actor/Mesh.cpp.obj -c D:/src/glsmac/src/graphics/opengl/actor/Mesh.cpp
D:\src\glsmac\out\build\x64-release-win-clang\CLANG_~1 : warning : argument unused during compilation: '-s' [-Wunused-command-line-argument]
D:\src\glsmac\src\graphics\opengl\actor\Mesh.cpp(239,23): error G38A6BD1A: variable-sized object may not be initialized
                                                  Vec3 light_pos[ lights->size() ] = {};
                                                                  ^~~~~~~~~~~~~~
D:\src\glsmac\src\graphics\opengl\actor\Mesh.cpp(240,26): error G38A6BD1A: variable-sized object may not be initialized
                                                  Color light_color[ lights->size() ] = {};
                                                                     ^~~~~~~~~~~~~~
  2 errors generated.
afwbkbc commented 1 year ago

Fixed in 46c7f15583c5a1938af7f

tsunamistate commented 1 year ago

Fix confirmed 🚀