AWS 开发工具包 C++ 代码不适用于发布版本
aws sdk c++ code don't work on release build
我在Visual Studio 2017中创建了一个.dll的c ++项目。我里面有使用 aws sdk 从 s3 存储桶获取文件的代码。
我在调试模式上构建了这个 dll 项目,并在我的主应用程序(也使用 c++(上使用它。它奏效了。
现在我确实制作了 dll 项目和我的主应用程序的发布版本。我的应用程序在执行"aws sdk c++"代码时崩溃。
以下是有关 aws 开发工具包 c++ 的代码片段:
int Download()
{
Aws::SDKOptions options;
Aws::InitAPI(options);
{
const Aws::String bucket_name = "timestamp-storage";
//Aws::String key_name = "";
const Aws::String region = "ap-northeast-1";
std::map<int, std::string> uploadedBioMap = BiometricDB::List();
std::map<int, std::string>::iterator i;
for (i = uploadedBioMap.begin(); i != uploadedBioMap.end(); i++) {
Aws::String key_name = i->second;
std::cout << "Downloading " << key_name << " from S3 bucket: " <<
bucket_name << std::endl;
Aws::Client::ClientConfiguration clientConfig;
if (!region.empty())
clientConfig.region = region;
Aws::S3::S3Client s3_client(clientConfig);
Aws::S3::Model::GetObjectRequest object_request;
object_request.WithBucket(bucket_name).WithKey(key_name);
auto get_object_outcome = s3_client.GetObject(object_request);
if (get_object_outcome.IsSuccess())
{
Aws::OFStream local_file;
local_file.open(("enroll/" + key_name).c_str(), std::ios::out | std::ios::binary);
local_file << get_object_outcome.GetResult().GetBody().rdbuf();
std::cout << "Done!" << std::endl;
}
else
{
std::cout << "GetObject error: " <<
get_object_outcome.GetError().GetExceptionName() << " " <<
get_object_outcome.GetError().GetMessage() << std::endl;
}
}
}
Aws::ShutdownAPI(options);
return 1;
}
希望有人能帮助我。
顺便说一句,我的代码没有任何问题。我刚刚发现我需要更新我在Visual Studio中安装的nuget包。所以当我这样做时,它解决了问题。谢谢。
相关文章:
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 导入库可以跨dll版本工作吗
- 在调用FreeLibrary后,释放动态链接到具有相同版本的CRT堆的DLL的内存
- 在clang++预处理器中确定gcc工具链版本
- 码头化的C++应用程序是否向后兼容早期的内核版本
- 不同的Visual Studio版本中缺少.dll
- 用符号版本替换对函数的所有调用
- luaL_dofile在已知良好的字节码上失败,可以使用未编译的版本
- 正在解码MSVC 32位版本的程序集(作业).没有手术做什么
- 我需要分发哪些版本的可再分发文件
- CV_OCL_RUN宏如何在OpenCV(版本3.4.5)的goodFeaturesToTrack实现中工作?
- 在运行时读取 libstdc++ 版本
- 如何声明一个可以在整个程序中使用的全局 2d 3d 4d .. 数组(堆版本)变量?
- FindPackageHandleStandardArgs.cmake:137 的 CMake 错误(消息):找不到 Boost (缺少:正则表达式)(找到合适的版本"1.72.0",
- Vulkan SDK 版本 1.1.85.0 在 Kubuntu 18.10 上链接
- 如何正确实现与基类不同的版本?
- 从预处理器获取 Windows 版本(C++ Win32)
- 表达式 SFINAE:如何根据类型是否包含具有一个或多个参数的函数来选择模板版本
- 如何在C++中将 Python 字符串转换为其转义版本?
- 在一个解决方案中针对第三方静态库 (Creo) 的不同版本(版本)进行构建