When using c# as the development language to convert Pb files into CS files, I believe many people will encounter a very difficult problem
The first question: in the protoc3 environment, import timestamp. In the header, import “Google/protobuf/timestamp. Proto”; Exceptions will be thrown when: Google/protobuf/timestamp. Proto “was not found or had errors;
Solution [sharing of original articles by blogger “pamxy”:
(Note: it was found later that it is not necessary to add this directory, because the timestamp.pb.cc file generated by timestamp.proto has been compiled as the source code when compiling libprotobuf.lib file, and libprotobuf.lib is also used in compiling protoc.exe, so it is natural to default that there is already a source code, so there is no need to import it again!)
Just delete the import “Google/protobuf/timestamp. Proto”.
Second question: ” google.protobuf.Timestamp” is not defined.
Under normal circumstances, there is no need to import google.protobuf.timestamp directly in the protoc3 environment, because in the compilation process, the problem will be read in the Lib file, but if timestamp is called in the file, it is as follows:
It is necessary to call the timestamp file in the header, but bloggers are always prompted during the call ” google.protobuf.Timestamp” is not defined.
There is really no way, so I have to find the path of this file: timestamp.proto file in protobuf master \ SRC \ Google \ protobuf folder, directly copy the file to the same level directory of the file you want to compile, and then modify the timestamp file in the header. The call path: Import “timestamp. Proto”;
Finally, the file was finally solved…….
The third question: how to call after converting the protocol file into a CS file?
a. Found in referenced project: Tools & gt& gt; Nuget package manager & gt& gt; Nuget package for management solution & gt& gt; Search for “Google. Protocolbuffers” and install
B, directly convert the protoc file into the CS file, and call it in the project.
This small problem is recorded, which is also convenient for you to use as a reference when you encounter this problem.
- ImportError: No module named google.protobuf.internal
- [Solved] panic: proto: duplicate enum registered: raftpb.EntryType
- The URL is timestamped to avoid caching problems when requesting the current path again
- Error: cannot find module ‘webpack cli/bin/config yargs’‘
- [Solved] Gradle NullPointerException at com.android.build.gradle.internal.ndk.NdkHandler.getPlatformVersion
- How to Solve Error: Cannot find the declaration of element ‘beans’.
- Keil’s duplicate definition problem: Error: L6200E: Symbol F6x8 multiply defined
- Execute an error under pytest cmd make sure your test modules/packages have valid Python names.
- [Solved] Maven Error: The packaging for this project did not assign a file to the build artifact
- GO Exception Runnerw.exe: CreateProcess failed with error 21
- Google Play googleapi: Error 403: Google Play Android Developer API has not been used in project
- How to Solve Import antd Error: Module build failed
- JSON parse error: raw timestamp (1595952000000) not allowed for
- [environment] docker: error response from daemon: OCI runtime
- Unity Package Webgl Error: Failed running “D:\Program Files\Unity2018.3.0f2\Unity\Editor\Data\PlaybackEngines\Web
- [Solved] OpenGL PowerVR SDK Compiling Error: Could NOT find X11 (missing: X11_X11_INCLUDE_PATH X11_X11_LIB)
- [Solved] Compilation error: dereferencing pointer to incomplete type…
- Maven Error: Missing artifact jdk.tools:jdk.tools:jar:1.7
- [Solved] Failed to resolve: com.serenegiant:common:1.5.20
- [Solved] Vscode Error: “export ‘default‘ (imported as ‘VueRouter‘) was not found in ‘vue-router‘