首页 > 解决方案 > 找不到 protobuf 头文件

问题描述

我在我的 ios 应用程序中 pod Protobuf-C++,但是构建失败,构建错误日志看起来像这样

- NOTE  | [iOS] xcodebuild:  Protobuf-C++/src/google/protobuf/io/zero_copy_stream.cc:35:10: fatal error: 'google/protobuf/io/zero_copy_stream.h' file not found
- NOTE  | [iOS] xcodebuild:  Protobuf-C++/src/google/protobuf/wrappers.pb.cc:4:10: fatal error: 'google/protobuf/wrappers.pb.h' file not found

有人知道如何解决这个问题吗?我的 protobuf 版本是 3.11.3

标签: protobuf-c

解决方案


像这样的问题

'google/protobuf/any.h' file not found
'google/protobuf/arena_test_util.h' file not found
'google/protobuf/util/delimited_message_util.h' file not found

也许没有找到其他文件。解决方法:

修复方法

1. select 'Pods'
2. select 'Protobuf-C++'
3. select 'Build Settings'
4. search 'search path'
5. select 'Header Search Paths'
6. add '$(SRCROOT)/Protobuf-C++/src'

推荐阅读