Author Topic: compilation issues with Visual Studio 2012 : C2977 and std::tuple  (Read 3344 times)

Offline jeancallisti

  • Squaddie
  • *
  • Posts: 5
    • View Profile
Please note:
- that this does not directly concern Open XCOM, but rather the Yaml library it relies on,
- that I don't have permissions to modify the wiki pages (neither here nor on the yaml project), so I can't just add the info there,
- that I'm only just posting this here because it may help someone out in the future.

Symptoms :
- After generating the Visual Studio 2012 (Visual Studio 11) solution using CMake, when you try to build it, you get a bunch of "C2977" compiling errors complaining about std::tuple.

Solution:
1) right-click on the yaml-cpp-whatever project inside Visual Studio
2) Properties, C/C++, Preprocessor, All Configurations All Platforms, Preprocessor Definitions, <Edit...>
3) add before <different options> the following row :
     _VARIADIC_MAX=10;
4) Now yaml should build properly

Explanations :
- This is caused by a poorly chosen setting in VS2012, that was later fixed in VS2013
- More explanations here : https://stackoverflow.com/questions/8274588/c2977-stdtuple-too-many-template-arguments-msvc11

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: compilation issues with Visual Studio 2012 : C2977 and std::tuple
« Reply #1 on: June 29, 2016, 07:41:51 pm »
`std::tuple` is C++11 class, OXC targets C++03. You portably should download older yaml that not use C++11 features yet.
Or switch to VS 2015 that have reasonable C++11 support.

Of course your work around is fine, but is possible that new yaml could have more problems on VS 2012.