MSVC 2015 Compilation Error C2996

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
FOFOFOFO
Space Krill
Posts: 7
Joined: Mon May 29, 2017 10:05 pm

MSVC 2015 Compilation Error C2996

#1 Post by FOFOFOFO » Tue May 30, 2017 4:59 am

Does anyone have problem compiling FreeOrion using Microsoft Visual Studio 2015 Update 3?

I follow the instruction at http://freeorion.org/index.php/Compile_In_Windows and got the "master" from GitHub. I am not sure if this is the latest or not. I have to change the Target Platform Version from 8.1 to 10.0.14393.0 otherwise it complains about missing header files. But now I am stuck at

Error C2996 'CombatEvent::serialize': recursive function template definition Common D:\VS\2015\Gaming\FreeOrion\FreeOrion\combat\CombatEvents.cpp 1172

I search the forum but didn't find anyone mention C2996 but searching the web did return 1 hit. It's 3 years old and whatever the problem is it was fixed in Boost 1.56. https://svn.boost.org/trac/boost/ticket/10348

I am not sure what is the actual cause of the error message because I don't know where to look for the problem. Line 1172 is the end of the file. I looked through CombatEvents.cpp but didn't actually see any problem. Any idea what is going on?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12268
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: MSVC 2015 Compilation Error C2996

#2 Post by Geoff the Medio » Tue May 30, 2017 5:58 am

FOFOFOFO wrote:I have to change the Target Platform Version from 8.1 to 10.0.14393.0 ...
Where / how do you change this setting?

FOFOFOFO
Space Krill
Posts: 7
Joined: Mon May 29, 2017 10:05 pm

Re: MSVC 2015 Compilation Error C2996

#3 Post by FOFOFOFO » Tue May 30, 2017 6:08 am

Geoff the Medio wrote:
FOFOFOFO wrote:I have to change the Target Platform Version from 8.1 to 10.0.14393.0 ...
Where / how do you change this setting?
Right click on each of the projects (Common, FreeOrion, FreeOrionCA, etc), select Properties.
At Project Properties Pages, under Configuration Properties->General->Target Platform Version.

This is only needed because I think Visual Studio does not install Windows 8.1 SDK or CRT or something by default. Anyway I only have Windows 10 installed.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12268
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: MSVC 2015 Compilation Error C2996

#4 Post by Geoff the Medio » Tue May 30, 2017 7:15 am

Can you get the 8.1 version of the Windows SDK (which I thought used to be called Platform Toolset)? I thought the various SDKs were specific to the MSVC version, not the OS version, though I haven't been cross-compiling for different Windows versions.

FOFOFOFO
Space Krill
Posts: 7
Joined: Mon May 29, 2017 10:05 pm

Re: MSVC 2015 Compilation Error C2996

#5 Post by FOFOFOFO » Wed May 31, 2017 1:54 am

Geoff the Medio wrote:Can you get the 8.1 version of the Windows SDK (which I thought used to be called Platform Toolset)? I thought the various SDKs were specific to the MSVC version, not the OS version, though I haven't been cross-compiling for different Windows versions.
Okay I am downloading it now. It will probably take awhile. I should be able to find out tomorrow.

FOFOFOFO
Space Krill
Posts: 7
Joined: Mon May 29, 2017 10:05 pm

Re: MSVC 2015 Compilation Error C2996

#6 Post by FOFOFOFO » Thu Jun 01, 2017 12:21 am

FOFOFOFO wrote:
Geoff the Medio wrote:Can you get the 8.1 version of the Windows SDK (which I thought used to be called Platform Toolset)? I thought the various SDKs were specific to the MSVC version, not the OS version, though I haven't been cross-compiling for different Windows versions.
Okay I am downloading it now. It will probably take awhile. I should be able to find out tomorrow.

I installed Windows 8.1 SDK from https://developer.microsoft.com/en-us/w ... ws-8-1-sdk
Is this the one you want me to install?
Change Target Platform version to 8.1 (Project properties->Configuration Properties->General->Target Platform Version = 8.1)
Rebuild Solution
Got tons of "cannot open source file ..." error on header files such as string.h, wchar.h
Change Target Platform version to 10.0.10586.0
Rebuild Solution
Got a few C2996 recursive function template definition errors

Post Reply