jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
5.09k stars 1.83k forks source link

Make test with 'MSys Makefiles' causes include errors 'unordered_map' and 'valarray' #1157

Closed niva-xx closed 1 year ago

niva-xx commented 1 year ago

Hi!,

I do the following to make test of yaml-cpp last git version 0.7.0 -- under MSys2 Win11 -- with cmake 3.25.0 using 'MSYS Makefiles' as described here :

MINGW64 ~/source/yaml/yaml-cpp/test
mkdir build
cd build
cmake -G "MSYS Makefiles" ..
make

It causes 2 main errors for file node_test.cpp as Building CXX object CMakeFiles/yaml-cpp-tests.dir/node/node_test.obj

source/yaml/yaml-cpp/test/node/node_test.cpp:45:109: error: 'unordered_map' in namespace 'std' does not name a template type
source/yaml/yaml-cpp/test/node/node_test.cpp:358:8: error: 'valarray' is not a member of 'std'

So, in node_test.cpp, i added these include

#include <unordered_map>
#include <valarray>

It causes the following errors: image

Thank you for help.

niva-xx commented 1 year ago

Solved by upgrading to cmake 3.25.0 pacman -R mingw-w64-x86_64-cmake if needed pacman -S mingw-w64-x86_64-cmake

and activating shared lib :

cd build
cmake -G "MSYS Makefiles" .. -DYAML_BUILD_SHARED_LIBS=ON
make