sandialabs / seacas

The Sandia Engineering Analysis Code Access System (SEACAS) is a suite of preprocessing, postprocessing, translation, and utility applications supporting finite element analysis software using the Exodus database file format.
Other
131 stars 79 forks source link

testwt-assembly.c: Error c2057 when building with MSVC and NetCDF binaries are found #438

Closed johnwparent closed 7 months ago

johnwparent commented 7 months ago

testwt-assembly.c:ln 95 raises error c2057 when Seacas is compiled under MSVC (tested with VS 16 + 17).

This is due to the use of a variable in an array declaration, which is invalid for the MSVC C compiler. This is not observed on the Seacas Windows CI as NetCDF binaries are not installed on the CI system and the CMake command that adds testwt-assembly.c as an executable is hidden behind a logical check for ncdump.exe. This is observed primarily with package managers like Spack or from source builds of NetCDF on the Windows platform that vendor the NetCDF bin utilities.

Simply leaving the test out of the build allows the rest of Seacas to compile and link as expected. See the Spack package patch for an example.

Happy to make whatever code/CMake changes need to be made myself, particularly if testing local changes on Windows is inaccessible to you folks.

gsjaardema commented 7 months ago

Thanks. I will just replace the num_elem_blk with its value of 7. Not recommended programming style for general use, but should be ok in this test code.

johnwparent commented 7 months ago

Works for me, thanks!

gsjaardema commented 7 months ago

See 29a9ebe