crysis_vrmod icon indicating copy to clipboard operation
crysis_vrmod copied to clipboard

build failing due to vector cs2440 - which buildenv?

Open Mixpicles opened this issue 9 months ago • 4 comments

Hi, I want to have a look at the code but c++ has been a while.

The compilation fails due to some cs2440 in vector. As it is in the depth of the stl, I assume that it is a versioning problem. Can you provide some information on you build environments/ tools, lib versions?

Best Regards

Mixpicles avatar Mar 17 '25 19:03 Mixpicles

Use Visual Studio 2022 with the provided Code\CrysisMod.sln. The code uses its own older STL version, which is setup in the provided solution. If you are using any other build setup, I'm afraid you are on your own.

fholger avatar Mar 17 '25 19:03 fholger

Hi, thanks for the reply. I did just that.

An update: I removed any win sdk from the vsinstaller. Now stdlib.h is missing from platform.h. Where do you get the libs from? Do I need some SDK binaries?

Mixpicles avatar Mar 17 '25 20:03 Mixpicles

I can only asume that vs community does things a bit differently or there is a version switch. However, I had to provide a reference to afxres.h (e.g. G:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\atlmfc\include)

As for the allocation problems, it appears that simply m_StanceWeponOffsetLeanRight[curStance]; Weapon.cpp, Line 531, will cause the problem.

I'll continue tomorrow

Mixpicles avatar Mar 20 '25 19:03 Mixpicles

It will build correctly with this diff applied (VS 2022 Community, nothing custom):

diff --git a/Code/CryEngine/CryCommon/VectorMap.h b/Code/CryEngine/CryCommon/VectorMap.h
index e2d2c9a..b913cab 100644
--- a/Code/CryEngine/CryCommon/VectorMap.h
+++ b/Code/CryEngine/CryCommon/VectorMap.h
@@ -56,7 +56,7 @@
 //
 //--------------------------------------------------------------------------

-template <typename K, typename V, typename T = std::less<K>, typename A = std::allocator<std::pair <const K, V> > >
+template <typename K, typename V, typename T = std::less<K>, typename A = std::allocator<std::pair <K, V> > >
 class VectorMap : private T // Empty base optimization
 {
 public:

I can only asume that vs community does things a bit differently or there is a version switch. However, I had to provide a reference to afxres.h (e.g. G:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\atlmfc\include)

If someone has this problem and doesn't have the afxres.h file on the disc, you need to go to VS Installer, go to specific packages section, search for C++ MFC and get the one for your current version and for x86/64.


Created PR to address this issue. Please re-test it on your own (I assume older?) MSVC if it still works for you. I successfully built it with v143.

RippeR37 avatar Aug 09 '25 23:08 RippeR37