You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

遵循AWS实时流转录示例时引入AudioStream.h编译报错求助

解决AWS C++ SDK实时流转录编译错误:JsonValue不完整类型

按照AWS官方实时流转录示例开发时,仅引入<aws/transcribestreaming/model/AudioStream.h>就触发编译错误,错误信息如下:

/usr/local/include/aws/transcribestreaming/model/AudioStream.h:47:36: error: calling 'Jsonize' with incomplete return type 'Aws::Utils::Json::JsonValue'
msg.WriteEventPayload(value.Jsonize().View().WriteCompact());
^~~
/usr/local/include/aws/transcribestreaming/model/ConfigurationEvent.h:40:68: note: 'Jsonize' declared here
AWS_TRANSCRIBESTREAMINGSERVICE_API Aws::Utils::Json::JsonValue Jsonize() const;
^
/usr/local/include/aws/transcribestreaming/model/PostCallAnalyticsSettings.h:18:9: note: forward declaration of 'Aws::Utils::Json::JsonValue'
class JsonValue;
^
In file included from audiopa.cpp:4:
/usr/local/include/aws/transcribestreaming/model/AudioStream.h:47:45: error: member access into incomplete type 'Aws::Utils::Json::JsonValue'
msg.WriteEventPayload(value.Jsonize().View().WriteCompact());
^
/usr/local/include/aws/transcribestreaming/model/PostCallAnalyticsSettings.h:18:9: note: forward declaration of 'Aws::Utils::Json::JsonValue'

解决方案

  • 补充包含JsonValue的完整定义头文件:
    在代码中,除了引入AudioStream.h,额外添加以下头文件:

    #include <aws/core/utils/json/JsonSerializer.h>
    

    该头文件包含Aws::Utils::Json::JsonValue的完整类定义,编译时就能解析Jsonize().View()这类成员调用。

  • 检查并升级AWS C++ SDK版本:
    此错误多因SDK头文件内部依赖遗漏导致,部分旧版本的Transcribe Streaming SDK未在AudioStream.h或其依赖头文件中自动包含JsonSerializer.h。升级至最新稳定版AWS C++ SDK,通常可修复这类依赖问题。

内容的提问来源于stack exchange,提问作者abscd

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 20:10:04