Compilation error ‘memcmp’ is not a member of ‘std’ on inputOutput/file.cpp
Closed this issue · 4 comments
Description
Compilaiton error
source/inputOutput/file.cpp:194:15: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘wmemcm ’?
When compiling from git repo using cmake .; make
(first encountered when trying to install on Arch with makepkg -si
but reproduced using cmake
and make
)
It seems there is a missing #include <cstring>
somewhere.
I guess it should be included in this file, and indeed this solved the problem.
I don't open a pull request firstly because i don't have experience developing c++ and secondly because the issue may be also solved by including directly on the file reported by the compiler, which is the only piece of code that requires it.
GROOPS version
main (latest commit)
Operating systems
- Linux
- Windows
- macOS
- Other (please specify in the description)
Log output
[ 0%] Building CXX object CMakeFiles/groopscore.dir/inputOutput/file.cpp.o
/home/javier/sources/groops-git/src/groops/source/inputOutput/file.cpp: En la función miembro ‘void StreamBase::open(const FileName&, std::ios_base::openmode)’:
/home/javier/sources/groops-git/src/groops/source/inputOutput/file.cpp:194:15: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘wmemcm ’?
194 | if(std::memcmp(magic, magicZlib, sizeof(magic)) == 0)
| ^~~~~~
| wmemcmp
/home/javier/sources/groops-git/src/groops/source/inputOutput/file.cpp:196:20: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘wmemcm ’?
196 | else if(std::memcmp(magic, magicCompress, sizeof(magic)) == 0)
| ^~~~~~
| wmemcmp
make[2]: *** [CMakeFiles/groopscore.dir/build.make:482: CMakeFiles/groopscore.dir/inputOutput/file.cpp.o] Error 1
make[2]: se sale del directorio '/home/javier/sources/groops-git/src/groops-git-r187.b7c87d2/build'
make[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/groopscore.dir/all] Error 2
make[1]: se sale del directorio '/home/javier/sources/groops-git/src/groops-git-r187.b7c87d2/build'
make: *** [Makefile:136: all] Error 2
make: se sale del directorio '/home/javier/sources/groops-git/src/groops-git-r187.b7c87d2/build'
Thank you for the hint. With the latest GCC version, the standards have been changed a bit. This was already fixed in our internal version, but I forgot to push this to github. Should be solved now.
regards
Torsten
Tested up to the latest commit (513e978) on the same Arch setting, compiles without errors
Thank you.
Javier
Dear GROOPS Developers,
I write to report that I experience the same error when I try to install the latest commit of GROOPS on a Windows machine. Please, refer to the following for further details.
####################################################################
C:\groops\source\inputOutput\file.cpp: In member function 'void StreamBase::open(const FileName&, std::ios_base::openmode)':
C:\groops\source\inputOutput\file.cpp:194:15: error: 'memcmp' is not a member of 'std'; did you mean 'wmemcmp'?
194 | if(std::memcmp(magic, magicZlib, sizeof(magic)) == 0)
| ^~~~~~
| wmemcmp
C:\groops\source\inputOutput\file.cpp:196:20: error: 'memcmp' is not a member of 'std'; did you mean 'wmemcmp'?
196 | else if(std::memcmp(magic, magicCompress, sizeof(magic)) == 0)
| ^~~~~~
| wmemcmp
mingw32-make[2]: *** [CMakeFiles\groopscore.dir\build.make:511: CMakeFiles/groopscore.dir/inputOutput/file.cpp.obj] Error 1
mingw32-make[2]: *** Waiting for unfinished jobs....
mingw32-make[1]: *** [CMakeFiles\Makefile2:86: CMakeFiles/groopscore.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2
Consolidate compiler generated dependencies of target groopscore
[ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_init.F90.obj
[ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_gfn.F90.obj
[ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_tfn.F90.obj
[ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_dfn.F90.obj
[ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_calc.F90.obj
C:\groops\source\external\nrlmsis2\msis_calc.F90:177:26:
177 | call bspline(zeta,nodesTN,nd+2,kmax,etaTN,Sz,iz)
| 1
Warning: Actual argument contains too few elements for dummy argument 'nodes' (30/31) at (1)
[ 1%] Building CXX object CMakeFiles/groopscore.dir/inputOutput/file.cpp.obj
C:\groops\source\inputOutput\file.cpp: In member function 'void StreamBase::open(const FileName&, std::ios_base::openmode)':
C:\groops\source\inputOutput\file.cpp:194:15: error: 'memcmp' is not a member of 'std'; did you mean 'wmemcmp'?
194 | if(std::memcmp(magic, magicZlib, sizeof(magic)) == 0)
| ^~~~~~
| wmemcmp
C:\groops\source\inputOutput\file.cpp:196:20: error: 'memcmp' is not a member of 'std'; did you mean 'wmemcmp'?
196 | else if(std::memcmp(magic, magicCompress, sizeof(magic)) == 0)
| ^~~~~~
| wmemcmp
mingw32-make[2]: *** [CMakeFiles\groopscore.dir\build.make:511: CMakeFiles/groopscore.dir/inputOutput/file.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:86: CMakeFiles/groopscore.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2
waley@roberts-8N6QM03 MINGW64 /c/groops/source/build
####################################################################
Thanks and looking forward to your usual support.
Regards,
Waley.