AWS C ++ SDK,SQS引发访问冲突

时间:2016-12-04 04:20:31

标签: c++11 amazon-web-services aws-sdk amazon-sqs

尝试使用AWS C ++ SDK创建SQS队列。

Aws::SDKOptions options; 
Aws::InitAPI(options); 
Aws::Client::ClientConfiguration configuration; 
configuration.region = Aws::Region::US_WEST_2; 
Aws::SQS::SQSClient sqs = new Aws::SQS::SQSClient(Aws::Auth::AWSCredentials("abc", "def"), configuration);

在Windows上运行,64位,VC ++。

当我跑步时,我将获得访问冲突:

Exception thrown at 0x000007FEE4E9C83C (aws-cpp-sdk-core.dll) in TestDB.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

这将发生在sdk的调用链中。没有参数我可以作为空指针传递给我,所以我不确定它是什么。我能够在没有任何问题的情况下与S3竞争,只是SQS。

它看起来像缺少初始化(但Aws :: InitAPI(选项);被调用),或者内存管理(我使用默认值)。最新的SDK版本。

任何帮助或想法都将受到赞赏。

-Yishai

更改了使用Aws :: SQS :: SQSClient *的调用,将所有NuGet包更新为latets版本(以x.60结尾)。这是堆栈跟踪:

aws-cpp-sdk-core.dll!000007fee4dfd4bc() Unknown
aws-cpp-sdk-core.dll!000007fee4d07962() Unknown
aws-cpp-sdk-core.dll!000007fee4d30a11() Unknown
aws-cpp-sdk-core.dll!000007fee4d301a5() Unknown
aws-cpp-sdk-core.dll!000007fee4d02710() Unknown
aws-cpp-sdk-sqs.dll!000007fee4ffe4e1()  Unknown
aws-cpp-sdk-sqs.dll!000007fee5046872()  Unknown
aws-cpp-sdk-sqs.dll!000007fee5046968()  Unknown
aws-cpp-sdk-sqs.dll!000007fee5046778()  Unknown
aws-cpp-sdk-sqs.dll!000007fee502f125()  Unknown
aws-cpp-sdk-sqs.dll!000007fee5002986()  Unknown
aws-cpp-sdk-sqs.dll!000007fee4fd2198()  Unknown
  

TestDB.exe!AmazonSQSQueue :: AmazonSQSQueue(std :: basic_string,std :: allocator> queueIdentifier,Aws :: Auth :: AWSCredentials * cred)第263行C ++

TestDB.exe!AmazonQueuesHolder::initilizeSQS(std::basic_string<char, std::char_traits<char>,std::allocator<char> > accessKey, std::basic_string<char,std::char_traits<char>,std::allocator<char> > secretKey, std::basic_string<char,std::char_traits<char>,std::allocator<char> > incommingQueueName, std::basic_string<char,std::char_traits<char>,std::allocator<char> > highPriorityQueueName, std::basic_string<char,std::char_traits<char>,std::allocator<char> > lowPriorityQueueName) Line 198   C++
TestDB.exe!SQSTest::SQSTest() Line 18   C++
TestDB.exe!testSQS() Line 24    C++
TestDB.exe!main(int argc, wchar_t * * argv) Line 183    C++
[External Code]

1 个答案:

答案 0 :(得分:0)

经过调查,这是由于链接类型不匹配造成的。 Aws-cpp-sdk-core是静态链接的,而Aws-cpp-sdk-sqs是动态链接的。更改nuget包以使用相同的链接类型将解决问题。