c++ - How do I use 'StartTranscriptionJobRequest' from the AWS Transcribe C++ API?
问题描述
I am having some difficulty with AWS Transcribe for C++. I believe a simple code example would solve it for me, but I find no code examples of the AWS Transcribe API in C++, (I realize there is one for TranscribeStreamingService, but my task is far simpler.)
According to the AWS docs for TranscribeServiceClient and StartTranscriptionJobRequest I need to create a StartTranscriptionJobRequest
object, fill it in with setters, and hand it to the TranscribeServiceClient
like this:
#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentialsProviderChain.h>
#include <aws/core/client/AWSClient.h>
#include <aws/transcribe/TranscribeServiceClient.h>
using namespace Aws;
using namespace Aws::TranscribeService;
using namespace Aws::TranscribeService::Model;
void TestAWSTranscript() {
Aws::SDKOptions options;
Aws::InitAPI(options);
{
Aws::Client::ClientConfiguration config;
TranscribeServiceClient TranscriptClient(Auth::AWSCredentials(user_access_key.c_str(), user_private_key.c_str()), config);
StartTranscriptionJobRequest request = new StartTranscriptionJobRequest();
// request.SetLanguageCode(Aws::TranscribeService::Model::LanguageCode::en_US);
// more setters here...
TranscriptClient.StartTranscriptionJob(&request);
// check for completion
// enjoy transcript...
}
Aws::ShutdownAPI(options);
}
but the line:
StartTranscriptionJobRequest request = new StartTranscriptionJobRequest();
produces the errors:
Allocation of incomplete type 'Aws::TranscribeService::Model::StartTranscriptionJobRequest'
Variable has incomplete type 'Aws::TranscribeService::Model::StartTranscriptionJobRequest'
If it helps, the aws sdk is open-source and available on git.
What am I misunderstanding?
解决方案
incomplete type means the complete class definition is not available/the class is only forward declared.
adding
#include <aws/transcribe/model/StartTranscriptionJobRequest.h>
should fix this
推荐阅读
- react-native - 屏幕更改时标签栏图标未完全居中
- c# - c#获取文本框中输入的值并根据选中的 2 个单选按钮执行计算并在标签中显示结果
- firebase - 'getDocuments' 已弃用,不应使用
- sql - 如何将时间范围拆分为多行
- python - 如何拆分正则表达式及其之后的所有内容
- reactjs - React 应用程序在 Windows 上工作,但在 Ubuntu 上不工作
- javascript - 在 React 中使用 Hooks 重用状态
- javascript - 蓝牙事件监听器“advertisementreceived”突然停止
- python - 灵敏度太低
- svg - 我怎样才能在一个圆圈内做一个清晰的图标