这似乎是protobuf链接错误。我正在描述我到达这里要遵循的步骤。

注意:以下链接用于安装 Protocol Buffer 编译器和gRPC。如果您已经有一个正在运行的gRPC系统,则可以跳过它

  • 我已按照相应重要链接中提到的步骤成功安装了protobuf和grpc。

    1. https://github.com/grpc/grpc/blob/master/BUILDING.md

    2. https://github.com/grpc/grpc/tree/master/src/cpp

    3. https://github.com/protocolbuffers/protobuf

  • 注意:以下链接是获取并运行Google为语音识别应用程序提供的示例代码。
  • https://github.com/GoogleCloudPlatform/cpp-docs-samples/tree/master/speech/api处关闭了仓库,并按照步骤1-9进行操作

  • 在步骤9-make run_tests上,我收到此错误
    g++ transcribe.o parse_arguments.o googleapis.ar -L/usr/local/lib `pkg-config --libs grpc++ grpc` -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed -lprotobuf -lpthread -ldl -o transcribe
    
    /usr/local/lib/libgrpc++_reflection.so: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::AssignDescriptorsTable*)'
    
    /usr/local/lib/libgrpc++_reflection.so: undefined reference to `google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable*, void (* const*)(), int)'
    
    collect2: error: ld returned 1 exit status
    
  • 我无法检查AssignDescriptorsAddDescriptors是否正确声明和定义。 在哪里可以找到这些声明的函数?
  • 是否缺少我要添加的标志和链接?

  • 任何积极的帮助将不胜感激。谢谢

    最佳答案

    我观察到grpc++版本1.19不支持protobuf-c版本15。

    为了使此工作有效,我将symlink指针从libprotobuf-c.so.15更改为libprotobuf-c.so.17

    关于c++ - Google语音识别(cpp示例):对AssignDescriptors()的 undefined reference ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54341578/

    10-11 12:17