Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building in visual studio 2015 #9

Open
Tfelk opened this issue Jun 30, 2016 · 9 comments
Open

Building in visual studio 2015 #9

Tfelk opened this issue Jun 30, 2016 · 9 comments

Comments

@Tfelk
Copy link

Tfelk commented Jun 30, 2016

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

@cookieseller
Copy link

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.

@jacobxy
Copy link

jacobxy commented Aug 25, 2016

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

@patrikohlsson
Copy link

patrikohlsson commented Sep 26, 2016

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

@bjj
Copy link

bjj commented Sep 26, 2016

Actually the whole thing should be in parenthesis too.

On Mon, Sep 26, 2016 at 12:01 PM, patrikohlsson notifications@github.com
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
#9 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAD0TZjnNx05RuaubP-B9lU6QX0l6vYxks5quBZugaJpZM4JCngK
.

@patrikohlsson
Copy link

Yes, forgot about that!

@lemming52
Copy link

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?

@jacobxy
Copy link

jacobxy commented Mar 23, 2017

I am trying to write this in golang!

@ghost
Copy link

ghost commented Dec 27, 2017

@bjj Worked without extra parenthesis.

@lemming52 Works for me in VS2013 Community.

@mshaheerm
Copy link

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 ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants