protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

identifier "GOOGLE_DCHECK" is undefined

Open automotiveUser opened this issue 6 years ago • 15 comments

Hi,

I am using Visual Studio 2017 Professional and Protocol Buffers V 3.9.1. I generated the header and source files depending on my proto files. I have multiple proto files but one of them is my "main" proto file which imports the other ones. In the pb.h of my "main" proto file I get the error, that the macro GOOGLE_DCHECK is undefined. I detected the definition of this macro in google\protobuf\stubs\logging.h. The header logging.h is included in my "main" pb.h file implicitly by including google\protobuf\arenastring.h

I detected, that after including google\protobuf\port_def.inc the macro GOOGLE_DCHECK is undefined. Is this a bug or is it my own mistake?

automotiveUser avatar Sep 27 '19 13:09 automotiveUser

I am also experiencing the same issue after generating my %.pb.h file from protoc.

iwita avatar Jan 08 '20 10:01 iwita

Getting the same error!

I installed grpc and protobuf via vcpkg, if this makes any difference.

ghost avatar Feb 04 '20 08:02 ghost

Same problem. First I installed protobuf from gRPC repository's master branch targeting protobuf 3.11.2, then from tag v1.26.0 targeting protobuf 3.8.0. I also tried installing the protobuf 3.11.3 from https://github.com/protocolbuffers/protobuf/releases/tag/v3.11.3

Every time I get the identifier "GOOGLE_DCHECK" is undefined error.

jlipponen avatar Feb 05 '20 10:02 jlipponen

As I said here https://stackoverflow.com/questions/60043400/linking-grpc-on-windows-for-visualc/60073170#60073170 I solved it by linking to WS2_32.lib

But it seems it does not solve the problem for everyone.

ghost avatar Feb 05 '20 10:02 ghost

I had the same problem but Disabling Precompiled Header works for me.

Project Properties > C/C++ > Precompiled Headers > Not Using Precompiled Headers

ShengHow95 avatar Mar 08 '20 14:03 ShengHow95

I had the same problem but Disabling Precompiled Header works for me.

Project Properties > C/C++ > Precompiled Headers > Not Using Precompiled Headers

Worked like a charm, thank you !

GerwazyMiod avatar Mar 28 '20 22:03 GerwazyMiod

Disabling the pre-compiled headers does not in fact do it for me,

Seems like I can build and compile the generated code but the grpcpp/ includes generate this error for me no matter what I try to do.

I am linking against headers and libraries directly from the repo on a Windows 10 Machine, v1.28.1. I tried using vcpkg but I get the same issue.

HiceS avatar Apr 13 '20 22:04 HiceS

I had the same problem but Disabling Precompiled Header works for me.

Project Properties > C/C++ > Precompiled Headers > Not Using Precompiled Headers

this does not work for me... Is there any solution to it yet? @anandolee @rafi-kamal ??

deepanshnagaria avatar Apr 17 '20 07:04 deepanshnagaria

As said here: https://github.com/protocolbuffers/protobuf/issues/6710#issuecomment-582342753 I needed to link to WS2_32.lib in addition to disabling precompiled headers.

ghost avatar Apr 17 '20 07:04 ghost

Neither of these seem to be resolving the issue for me.

matttm avatar Oct 20 '20 14:10 matttm

I'm using 3.13 and VS17 and I'm getting this GOOGLE_DCHECK is undefined. I've tried turning off precompiled headers and linking to WS2_32.lib but these solutions haven't worked for me.

ajwhite-git avatar Nov 06 '20 09:11 ajwhite-git

I tried to comment lines from first #include <google/protobuf/port_def.inc> to #include <google/protobuf/port_undef.inc> in generated header file.

Error dissapeared and my app seems to work fine, but I'm not sure that this is a good solution.

K4kTyC avatar Nov 21 '20 22:11 K4kTyC

Has there been a solution to this problem? I am getting this on 3.14

abdulwahabamin avatar Jan 20 '21 17:01 abdulwahabamin

I've unfortunately run into the same problem. As mentioned previously turning off precompiled headers and linking to WS2_32.lib did not resolve the issue.

AaronViviano avatar Jan 30 '21 19:01 AaronViviano

Has there been a solution to this problem? I have met this problem when I use VS2019 and I installed grpc by vcpkg

TengQinglong avatar Apr 28 '21 08:04 TengQinglong

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Mar 31 '24 10:03 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Apr 14 '24 10:04 github-actions[bot]