AwsStringStream.h: 没有那个文件或目录
AwsStringStream.h: No such file or directory
我正在编写此 link 中的教程。
我拥有所有库并安装了 aws-cpp-sdk。
我在 /usr/local/include.
中有 aws 文件夹
When I make the cpp file, I have error as
sudo make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/Softwares/Projects/S3upload/build
[100%] Building CXX object CMakeFiles/S3upload.dir/S3upload.cpp.o
/home/Softwares/Projects/S3upload/S3upload.cpp:4:56: fatal error: aws/core/utils/memory/stl/AwsStringStream.h: No such file or directory
#include <aws/core/utils/memory/stl/AwsStringStream.h>
^
compilation terminated.
make[2]: *** [CMakeFiles/S3upload.dir/S3upload.cpp.o] Error 1
make[1]: *** [CMakeFiles/S3upload.dir/all] Error 2
make: *** [all] Error 2
有什么问题吗?
我的 cpp 文件是
#include <aws/s3/S3Client.h>
#include <aws/s3/model/PutObjectRequest.h>
#include <aws/s3/model/GetObjectRequest.h>
#include <aws/core/utils/memory/stl/AwsStringStream.h>
using namespace Aws::S3;
using namespace Aws::S3::Model;
static const char* KEY = "xxxxxxxxxxxx";//"s3_cpp_sample_key";
static const char* BUCKET = "xxxxxx";//"s3-cpp-sample-bucket";
int main()
{
S3Client client;
//first put an object into s3
PutObjectRequest putObjectRequest;
putObjectRequest.WithKey(KEY)
.WithBucket(BUCKET);
//this can be any arbitrary stream (e.g. fstream, stringstream etc...)
auto requestStream = Aws::MakeShared<Aws::StringStream>("s3-sample");
*requestStream << "Hello World!";
//set the stream that will be put to s3
putObjectRequest.SetBody(requestStream);
auto putObjectOutcome = client.PutObject(putObjectRequest);
if(putObjectOutcome.IsSuccess())
{
std::cout << "Put object succeeded" << std::endl;
}
else
{
std::cout << "Error while putting Object " << putObjectOutcome.GetError().GetExceptionName() <<
" " << putObjectOutcome.GetError().GetMessage() << std::endl;
}
return 0;
}
我的CMakeLists.txt是
cmake_minimum_required(VERSION 2.8)
project(S3upload)
#this will locate the aws sdk for c++ package so that we can use its targets
#/usr/src/Softwares/AWSC++SDK/aws-sdk-cpp/build/
find_package(aws-sdk-cpp)
add_executable(S3upload S3upload.cpp)
#since we called find_package(), this will resolve all dependencies, header files, and cflags necessary
#to build and link your executable.
target_link_libraries(S3upload aws-cpp-sdk-s3)
尝试将头文件放在引号中并检查它们是否确实位于正确的目录中
您确定 aws/core/utils/memory/stl/AwsStringStream.h 存在于 /user/local/include 下吗?注意文件名是区分大小写的,你确定文件名是 AwsStringStream.h 吗?
我正在编写此 link 中的教程。 我拥有所有库并安装了 aws-cpp-sdk。 我在 /usr/local/include.
中有 aws 文件夹When I make the cpp file, I have error as
sudo make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/Softwares/Projects/S3upload/build
[100%] Building CXX object CMakeFiles/S3upload.dir/S3upload.cpp.o
/home/Softwares/Projects/S3upload/S3upload.cpp:4:56: fatal error: aws/core/utils/memory/stl/AwsStringStream.h: No such file or directory
#include <aws/core/utils/memory/stl/AwsStringStream.h>
^
compilation terminated.
make[2]: *** [CMakeFiles/S3upload.dir/S3upload.cpp.o] Error 1
make[1]: *** [CMakeFiles/S3upload.dir/all] Error 2
make: *** [all] Error 2
有什么问题吗? 我的 cpp 文件是
#include <aws/s3/S3Client.h>
#include <aws/s3/model/PutObjectRequest.h>
#include <aws/s3/model/GetObjectRequest.h>
#include <aws/core/utils/memory/stl/AwsStringStream.h>
using namespace Aws::S3;
using namespace Aws::S3::Model;
static const char* KEY = "xxxxxxxxxxxx";//"s3_cpp_sample_key";
static const char* BUCKET = "xxxxxx";//"s3-cpp-sample-bucket";
int main()
{
S3Client client;
//first put an object into s3
PutObjectRequest putObjectRequest;
putObjectRequest.WithKey(KEY)
.WithBucket(BUCKET);
//this can be any arbitrary stream (e.g. fstream, stringstream etc...)
auto requestStream = Aws::MakeShared<Aws::StringStream>("s3-sample");
*requestStream << "Hello World!";
//set the stream that will be put to s3
putObjectRequest.SetBody(requestStream);
auto putObjectOutcome = client.PutObject(putObjectRequest);
if(putObjectOutcome.IsSuccess())
{
std::cout << "Put object succeeded" << std::endl;
}
else
{
std::cout << "Error while putting Object " << putObjectOutcome.GetError().GetExceptionName() <<
" " << putObjectOutcome.GetError().GetMessage() << std::endl;
}
return 0;
}
我的CMakeLists.txt是
cmake_minimum_required(VERSION 2.8)
project(S3upload)
#this will locate the aws sdk for c++ package so that we can use its targets
#/usr/src/Softwares/AWSC++SDK/aws-sdk-cpp/build/
find_package(aws-sdk-cpp)
add_executable(S3upload S3upload.cpp)
#since we called find_package(), this will resolve all dependencies, header files, and cflags necessary
#to build and link your executable.
target_link_libraries(S3upload aws-cpp-sdk-s3)
尝试将头文件放在引号中并检查它们是否确实位于正确的目录中
您确定 aws/core/utils/memory/stl/AwsStringStream.h 存在于 /user/local/include 下吗?注意文件名是区分大小写的,你确定文件名是 AwsStringStream.h 吗?