-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
Failed to Build Visual Stuido C++ Project with .pb.h and .pb.cc #9676
Comments
Having the same issue, our project builds fine on Linux but it is getting a lot of errors from the protobuf macros on Visual Studio 2019 |
build protobuf x64 with vs /MDd will get rid of this trouble |
changing the "C++ Language Standard" to "ISO C++ 17 Standard (/std:c++17)" resolved the header issues "Error (active) E0077". |
same problem, but can build, run without error |
same problem,but my OS is Ubuntu 18.04 ::PROTOBUF_NAMESPACE_ID:: |
I am having the same issue. Compiling with Visual Studio 2022. I've tried the suggestions by @vasdev8 and @sigaaron with no luck |
Same issue here in VS 2022. |
|
Same issue in VS2022. |
|
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 |
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 |
What version of protobuf and what language are you using?
Version: protobuf-3.19.4
Language: C++ 14
What operating system (Linux, Windows, ...) and version?
Windows 10
What runtime / compiler are you using (e.g., python version or gcc version)
MSVC 19.29.30141.0
CMake 3.22.0 -- Configure BUILD_SHARED_LIBS
What did you do?
Steps to reproduce the behavior:
.\protoc.exe --cpp_out=./ .\test.proto
What did you expect to see
build suceess
What did you see instead?
And once I opened "test.pb.h" in vs editor, hundreds of errors occured
e.g some macro marked error
PROTOBUF_NAMESPACE_OPEN
Error (active) E0077 this declaration has no storage class or type specifier
::PROTOBUF_NAMESPACE_ID::
Error (active) E0276 name followed by '::' must be a class or namespace name
Furthermore, if
import "google/protobuf/any.proto";
How Can I correctly build? Thanks a lot!!!
The text was updated successfully, but these errors were encountered: