TLDR;
Having trouble compiling Elmer in MSVS using the Mingw64-Debug configuration. Seems like some header files can't be found or there is some other issue surrounding the header files. Has anyone been able to compile the source code in Visual Studio? If so, what steps are required to make this work? If this is not possible or very difficult, why?
I've been successful in following the compilation instructions, using MSYS2 terminal with MinGW to compile the source code. (https://github.com/ElmerCSC/elmerfem/bl ... s-msys2.md)
I am trying to replicate the compilation process in MSVS 2019 since I plan to edit the source code and would rather do this in an IDE that can run Elmer in debug mode.
When i attempt to "build all" in Visual Studio, using the Mingw64-Debug configurations, I get many errors. Among them, I am getting 16 errors in matc\src\matrix.c saying that some math functions are undeclared:
Code: Select all
Error G0DAE3095 'exp' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 554
Error G162405AE 'acos' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 548
Error G18A1A76C 'atan2' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 550
Error G220463D1 'log10' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 556
Error G46E5BD8D 'floor' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 559
Error G485019DD 'sqrt' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 557
Error G48F04A0C 'asin' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 547
Error G5E2AEEE4 'atan' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 549
Error G5FA84A0A 'ceil' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 558
Error GAAA2AA8B 'log' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 555
Error GBA859120 'tanh' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 553
Error GBA8D9121 'sinh' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 551
Error GBD558E68 'cosh' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 552
Error GF2BD9120 'tan' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 546
Error GF2C59121 'sin' undeclared (first use in this function); did you mean 'sign'? D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 544
Error GF58D8E68 'cos' undeclared (first use in this function) D:\elmerfem\out\build\Mingw64-Debug\elmerfem D:\elmerfem\matc\src\matrix.c 545
I have tried modifying the CMakeSettings.JSON file to match the commands used in MSYS2, but I'm not confident about how i've done this (file attached).
In some cases, i also get this error message when attempting to build:
Code: Select all
Error (active) E1696 cannot open source file "unistd.h" libmatc.dll (matc\src\libmatc.dll) - Mingw64-Debug D:\elmerfem\matc\src\elmer\matc.h 41
- Ctype.h
- Math.h
- Setjmp.h
- Signal.h
- Stdarg.h
- Stdio.h
- Stdlib.h
- String.h
- Time.h
- Unistd.h
- Sys\types.h
Doing this changes nothing - i still get the same errors.
In case it helps, here are the other errors that i get (at the same time as the "undeclared" errors, above):
Code: Select all
Error (active) E0018 expected a ')' ElmerGrid.exe (elmergrid\src\ElmerGrid.exe) - Mingw64-Debug C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\stdlib.h 722
Error (active) E0020 identifier "pack" is undefined ElmerGrid.exe (elmergrid\src\ElmerGrid.exe) - Mingw64-Debug C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\limits.h 16
Error (active) E0020 identifier "size_t" is undefined ElmerGrid.exe (elmergrid\src\ElmerGrid.exe) - Mingw64-Debug C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_wstdio.h 95
Error (active) E0020 identifier "FILE" is undefined ElmerGrid.exe (elmergrid\src\ElmerGrid.exe) - Mingw64-Debug C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_wstdio.h 107
Error (active) E0065 expected a ';' ElmerGrid.exe (elmergrid\src\ElmerGrid.exe) - Mingw64-Debug C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\vadefs.h 61
Error (active) E0172 external/internal linkage conflict with previous declaration at line 110 of "C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\stdio.h" ElmerGrid.exe (elmergrid\src\ElmerGrid.exe) - Mingw64-Debug C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_wstring.h 161
Error (active) E0757 variable "uintptr_t" is not a type name ElmerGrid.exe (elmergrid\src\ElmerGrid.exe) - Mingw64-Debug C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt.h 366
Error (active) E0757 variable "__int64" is not a type name ElmerGrid.exe (elmergrid\src\ElmerGrid.exe) - Mingw64-Debug C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt.h 594
I have 22 errors with code E0018 ( expected a ')' ) and 53 errors with code E0065 ( expected a ';' ).
I also have 163 errors with code E0757 (variable "___" is not a type name), where the blank is __int64, size_t, or uintptr_t.
If there is any part of this that anyone understands or knows how to resolve, please let me know! I'm sure that i didn't provide all necessary information, so please ask for more info where needed.
Thanks!