protobuf中,提示 /google/protobuf/ 文件不存在的解决办法

博客介绍了如何在Windows 64位系统上下载并使用protobuf的特定版本protoc-21.1-win64.zip。解压缩后,可以在include文件夹中找到google定义的proto文件,例如any.proto。

在这个上面下载 Releases · protocolbuffers/protobuf · GitHub

和自己的平台有关:

比如windows 64位 下载 protoc-21.1-win64.zip。

解压后,include文件夹内就是google定义的proto文件,如any.proto 之类。

 

C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:112:8: error: 'once_flag' in namespace 'std' does not name a type std::once_flag flag_; ^~~~~~~~~ C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:112:3: note: 'std::once_flag' is defined in header '<mutex>'; did you forget to '#include <mutex>'? C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:65:1: +#include <mutex> C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:112:3: std::once_flag flag_; ^~~ C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: In constructor 'constexpr google::protobuf::internal::CallOnceInitializedMutex<T>::CallOnceInitializedMutex()': C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:100:42: error: class 'google::protobuf::internal::CallOnceInitializedMutex<T>' does not have any field named 'flag_' constexpr CallOnceInitializedMutex() : flag_{}, buf_{} {} ^~~~~ C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: In member function 'T& google::protobuf::internal::CallOnceInitializedMutex<T>::get()': C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:108:10: error: 'call_once' is not a member of 'std' std::call_once(flag_, [&] { ::new (static_cast<void*>(&buf_)) T(); }); ^~~~~~~~~ C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:108:10: note: suggested alternative: 'all_of' std::call_once(flag_, [&] { ::new (static_cast<void*>(&buf_)) T(); }); ^~~~~~~~~ all_of C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:108:20: error: 'flag_' was not declared in this scope std::call_once(flag_, [&] { ::new (static_cast<void*>(&buf_)) T(); }); ^~~~~ C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: At global scope: C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:136:33: error: 'mutex' is not a member of 'std' CallOnceInitializedMutex<std::mutex> mu_{}; ^~~~~ C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:136:33: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'? C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:136:33: error: 'mutex' is not a member of 'std' C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:136:33: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'? C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:136:38: error: template argument 1 is invalid CallOnceInitializedMutex<std::mutex> mu_{}; ^ C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: In member function 'void google::protobuf::internal::WrappedMutex::Lock()': C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:126:47: error: request for member 'lock' in '((google::protobuf::internal::WrappedMutex*)this)->google::protobuf::internal::WrappedMutex::mu_', which is of non-class type 'int' void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); } ^~~~ C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: In member function 'void google::protobuf::internal::WrappedMutex::Unlock()': C:/mycv/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:127:49: error: request for member 'unlock' in '((google::protobuf::internal::WrappedMutex*)this)->google::protobuf::internal::WrappedMutex::mu_', which is of non-class type 'int' void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); } ^~~~~~报错咋解决
10-27
root@JFPC1:~/Workspace/protobuf-21.12# make -j$(nproc) make all-recursive make[1]: Entering directory '/root/Workspace/protobuf-21.12' Making all in . make[2]: Entering directory '/root/Workspace/protobuf-21.12' make[2]: Leaving directory '/root/Workspace/protobuf-21.12' Making all in src make[2]: Entering directory '/root/Workspace/protobuf-21.12/src' CXX google/protobuf/wire_format.lo CXX google/protobuf/wrappers.pb.lo CXX google/protobuf/compiler/command_line_interface.lo CXX google/protobuf/compiler/code_generator.lo CXX google/protobuf/compiler/plugin.lo CXX google/protobuf/compiler/plugin.pb.lo CXX google/protobuf/compiler/subprocess.lo CXX google/protobuf/compiler/zip_writer.lo CXX google/protobuf/any_lite.lo CXX google/protobuf/compiler/main.o CXX google/protobuf/arenastring.lo CXX google/protobuf/arena.lo CXX google/protobuf/arenaz_sampler.lo CXX google/protobuf/extension_set.lo CXX google/protobuf/generated_enum_util.lo CXX google/protobuf/generated_message_tctable_lite.lo CXX google/protobuf/generated_message_util.lo CXX google/protobuf/implicit_weak_message.lo CXX google/protobuf/inlined_string_field.lo CXX google/protobuf/io/coded_stream.lo CXX google/protobuf/io/io_win32.lo CXX google/protobuf/io/strtod.lo CXX google/protobuf/io/zero_copy_stream.lo CXX google/protobuf/io/zero_copy_stream_impl.lo CXX google/protobuf/io/zero_copy_stream_impl_lite.lo CXX google/protobuf/map.lo CXX google/protobuf/message_lite.lo CXX google/protobuf/parse_context.lo CXX google/protobuf/repeated_field.lo CXX google/protobuf/repeated_ptr_field.lo CXX google/protobuf/stubs/bytestream.lo CXX google/protobuf/stubs/common.lo CXX google/protobuf/stubs/int128.lo CXX google/protobuf/stubs/status.lo CXX google/protobuf/stubs/statusor.lo 这里报
03-15
[ 50%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj In file included from D:\dongfangruitong\Qt\opc\opencv\sources\3rdparty\protobuf\src\google\protobuf\arena.cc:42:0: D:/dongfangruitong/Qt/opc/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: In constructor 'constexpr google::protobuf::internal::WrappedMutex::WrappedMutex()': D:/dongfangruitong/Qt/opc/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:124:29: error: temporary of non-literal type 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' in a constant expression constexpr WrappedMutex() {} ^ D:/dongfangruitong/Qt/opc/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note: 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' is not literal because: class CallOnceInitializedMutex { ^~~~~~~~~~~~~~~~~~~~~~~~ D:/dongfangruitong/Qt/opc/opencv/sources/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note: 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' has a non-trivial destructor 3rdparty\protobuf\CMakeFiles\libprotobuf.dir\build.make:93: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj' failed mingw32-make[2]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj] Error 1 CMakeFiles\Makefile2:2317: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all' failed mingw32-make[1]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all] Error 2 Makefile:164: recipe for target 'all' failed mingw32-make: *** [all] Error 2
07-02
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值