i working on tutorial in link. have libraries , aws-cpp-sdk installed. have aws folder inside /usr/local/include.
when make cpp file, have error 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
what wrong? cpp file
#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 object s3 putobjectrequest putobjectrequest; putobjectrequest.withkey(key) .withbucket(bucket); //this can arbitrary stream (e.g. fstream, stringstream etc...) auto requeststream = aws::makeshared<aws::stringstream>("s3-sample"); *requeststream << "hello world!"; //set stream put 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; }
my cmakelists.txt is
cmake_minimum_required(version 2.8) project(s3upload) #this locate aws sdk c++ package can use targets #/usr/src/softwares/awsc++sdk/aws-sdk-cpp/build/ find_package(aws-sdk-cpp) add_executable(s3upload s3upload.cpp) #since called find_package(), resolve dependencies, header files, , cflags necessary #to build , link executable. target_link_libraries(s3upload aws-cpp-sdk-s3)
are sure aws/core/utils/memory/stl/awsstringstream.h exists under /user/local/include ? note file name case sensitive, sure file name awsstringstream.h ?
Comments
Post a Comment