Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Unable to build CopperCube client (studio edition)

airways
Registered User
Quote
2021-07-27 18:54:53

I have registered Studio edition and am attempting to build the client in VS 2019. I have the DX9 Jun20 SDK installed and updated the include reference to the installed path under C:\Program Files (x86) from the one at D:\Programs that it defaults to.

Unfortunately I'm running into this error in building flaceLib:

Error C2065 'PTRDIFF_MAX': undeclared identifier flaceLib C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm 49

Line 49 is the return statement of this function:

// STRUCT TEMPLATE _Optimistic_temporary_buffer
template <class _Diff>
constexpr ptrdiff_t _Temporary_buffer_size(const _Diff _Value) noexcept {
// convert an iterator difference_type to a ptrdiff_t for use in temporary buffers
using _CT = common_type_t<ptrdiff_t, _Diff>;
return static_cast<ptrdiff_t>((_STD min)(static_cast<_CT>(PTRDIFF_MAX), static_cast<_CT>(_Value)));
}

This of course causes a link error when trying to link win32player:

Error LNK1104 cannot open file 'C:\Dev\Projects\CopperCube\windows\src\win32player\x64\Debug\flaceLib.lib' win32player C:\Dev\Projects\CopperCube\windows\src\win32player\LINK 1

Any ideas why PTRDIFF_MAX would seemingly be undefined in algorithm? I am not super familiar with C++ but have done a lot of C and Win32 programming so I'm not really sure what could cause this. I did try including cstdint before each use of algorithm but that didn't seem to help.

The only other reference to this issue I could find was on a steam thread for CopperCube 5 but there was no resolution: https://steamcommunity.com/app/3...

One possibility I've considered is that my version of the Windows SDK is too new and I need to be using either an older version of VS or an older SDK with 2019. However it's quite a task to just keep installing and trying versions of Visual Studio or SDKs until one works, and I'm not 100% convinced that is the problem anyway.

Would really appreciate any help!


just_in_case
Moderator
Quote
2021-07-28 12:50:32

well, I just downloaded and tried to build source file, I am using VS 2019, and I didn't get any PTRDIFF_MAX error, there is one error which is of flaceLib.lib I performed a search in the source directory and found that there is actually no flaceLib.lib file. below is the screenshot of the error there are some warnings as well.

🔎︎



airways
Registered User
Quote
2021-07-28 14:48:25

Did you open the vcxproj project or the sln? If you open the sln it should build flaceLib for you first (it is a Project Reference within the sln), but in my environment I am getting an error when trying to build flaceLib -- which then causes the same link error you get as the second error.

One thing that does seem to be different is that your error message is a relative path rather than a full path like mine was. Not sure if that's significant or not.


just_in_case
Moderator
Quote
2021-07-28 19:16:11

Well, You can fix the PTRDIFF_MAX by including <stdint.h>, when building the project through solution I did encountered the same PTRDIFF_MAX.

here is what I did to get rid of this error, First I replaced old stdint.h file in the directory src\flacelib\assimp\irr_extensions with the newer one from

Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30037\include

and added include <stdint.h> in my algorith file.

and It did fixed the error PTRDIFF_MAX undeclared. but there are still no file and directory found error with error code C1083, which I think is because I have no DirectX SDK Installed. They all are related to directX.

but the last error of FlaceLib.lib is also there which is because there are other errors, if there will be no error than the FlaceLib.lib will be gone that's what I think. The other errors are because of missing DirectX sdk.

Hope you will get to build the app successfully and hope the above method will at least fix your issue of PTRDIFF_MAX error.


airways
Registered User
Quote
2021-07-28 21:33:06

Hmm, good find. I renamed the stdint.h that is included in the client source at that path, and it builds! Appears that the included one was hiding the one provided by the SDK.

So I actually have a functional 32-bit build now!

I wonder if that file has needed patches for 64-bit however, because although the client builds, but it now crashes (the following applies only to the 64-bit build):

---------------------------
win32player.exe - Application Error
---------------------------
The application was unable to start correctly (0xc000007b). Click OK to close the application.
---------------------------
OK
---------------------------

Seems like that error is related to an invalid image (EXE) format, so mixing x86 and x64 somehow maybe? Not something I've really dealt with so I'm not sure.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact