csgo-demoinfo icon indicating copy to clipboard operation
csgo-demoinfo copied to clipboard

Building in visual studio 2015

Open Tfelk opened this issue 9 years ago • 9 comments

Is this possible? Im getting a few errors trying to build "libprotobuf" as described in the readme. Maybe its because im in VS2015.

Here are the errors:

1>C:\Program Files (x86)\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. 1>C:\Program Files (x86)\VC\include\hash_set(17): error C2338: <hash_set> is deprecated and will be REMOVED. Please use <unordered_set>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning.

This pair of errors occurs 6 times, additionally:

1>..\src\google\protobuf\io\zero_copy_stream_impl_lite.cc(66): error C3861: 'min': identifier not found 1>..\src\google\protobuf\io\zero_copy_stream_impl_lite.cc(119): error C3861: 'min': identifier not found 1>..\src\google\protobuf\io\zero_copy_stream_impl_lite.cc(166): error C3861: 'max': identifier not found 1>..\src\google\protobuf\io\zero_copy_stream_impl_lite.cc(193): error C3861: 'min': identifier not found

Tfelk avatar Jun 30 '16 21:06 Tfelk

Hey, I'm not too sure what changed between VS2010 and VS2015 but these errors can easily be fixed. For the hash_map error do as it says, define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS and the min max errors can be fixed by including algorithm in the mentioned file. Note that I'm not sure if this is the correct solution or why algorithm wasn't included in the first place but for me this fixed all errors and I can build on VS2015.

cookieseller avatar Aug 15 '16 10:08 cookieseller

You can write the code by yourself like this: #define min(x,y) x>y?y:x #define max(x,y) x>y?x:y

jacobxy avatar Aug 25 '16 03:08 jacobxy

That could cause precedence issues, if you're defining them yourself it should be:

#define min(x,y) ((x)>(y)?(y):(x)) 
#define max(x,y) ((x)>(y)?(x):(y))

Just including the algorithm header and defining _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS solves it too.

EDIT: Statement should also have surrounding parenthesis

patrikohlsson avatar Sep 26 '16 19:09 patrikohlsson

Actually the whole thing should be in parenthesis too.

On Mon, Sep 26, 2016 at 12:01 PM, patrikohlsson [email protected] wrote:

That could cause precedence issues, if you're defining them yourself it should be:

#define min(x,y) (x)>(y)?(y):(x) #define max(x,y) (x)>(y)?(x):(y)

Just including the algorithm header and defining _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS solves it too.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ValveSoftware/csgo-demoinfo/issues/9#issuecomment-249664737, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD0TZjnNx05RuaubP-B9lU6QX0l6vYxks5quBZugaJpZM4JCngK .

bjj avatar Sep 26 '16 19:09 bjj

Yes, forgot about that!

patrikohlsson avatar Sep 26 '16 19:09 patrikohlsson

Might be foolish, but I'm having crashes after building related to heap corruption and access violation in the protobuf. I'm using vs2017 and applied they above workarounds to hash map and min/max. Is this likely some kind of configuration error on my part?

lemming52 avatar Mar 21 '17 17:03 lemming52

I am trying to write this in golang!

jacobxy avatar Mar 23 '17 10:03 jacobxy

@bjj Worked without extra parenthesis.

@lemming52 Works for me in VS2013 Community.

ghost avatar Dec 27 '17 14:12 ghost

capture I am having these errors in VS2017. how can i fix them and where do i need to append_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS ??

mshaheerm avatar Jul 10 '18 08:07 mshaheerm