Git Product home page Git Product logo

cos-cpp-sdk-v4's Introduction

tencentyun-cos-cpp-sdk-v4

已弃用 - 请升级到 cos-cpp-sdk-v5

SDK 依赖的 JSON API 已弃用,请直接使用基于 XML API 的 cos-cpp-sdk-v5,或者参照 升级指引 升级到新版SDK。

开发环境

依赖静态库: curl jsoncpp boost_system boost_thread (在lib文件夹下)

依赖动态库: ssl crypto rt z (需要安装)

  1. 安装openssl的库和头文件 http://www.openssl.org/source/
  2. 安装curl的库和头文件 http://curl.haxx.se/download/curl-7.43.0.tar.gz
  3. 安装jsoncpp的库和头文件 https://github.com/open-source-parsers/jsoncpp
  4. 安装boost的库和头文件 http://www.boost.org/
  5. 安装cmake工具 http://www.cmake.org/download/

本地编译说明

修改CMakeList.txt文件中,指定本地boost头文件路径,修改如下语句:

SET(BOOST_HEADER_DIR "/root/boost_1_61_0")

配置文件说明

"Region":"sh",                    //所属COS区域,上传下载操作的URL均与该参数有关
"SignExpiredTime":360,            //签名超时时间,单位:秒
"CurlConnectTimeoutInms":10000,   //CURL连接超时时间,单位:毫秒
"CurlGlobalConnectTimeoutInms":360000, //CURL连接执行最大时间,单位:毫秒
"UploadSliceSize":1048576,        //分片大小,单位:字节,可选的有512k,1M,2M,3M(需要换算成对应字节数)
"IsUploadTakeSha":0,              //上传文件时是否需要携带sha值
"DownloadDomainType":2,           //下载域名类型:1: cdn, 2: cos, 3: innercos, 4: self domain
"SelfDomain":"",                  //自定义域名
"UploadThreadPoolSize":5          //单文件分片上传线程池大小
"AsynThreadPoolSize":2            //异步上传下载线程池大小
"LogoutType":0                    //打印输出,0:不输出,1:输出到屏幕,2:打印syslog
"down_thread_pool_max_size":10    //下载文件到本地的线程池的最大大小,默认值为10,有效值的范围:(0,10]
"down_slice_size":4194304         //下载文件到本地的分片大小,range的范围,默认值4M,有效值范围:[4k,20M]

cos-cpp-sdk-v4's People

Contributors

jonnxu avatar konakonall avatar rabbitliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cos-cpp-sdk-v4's Issues

windows 平台支持

问题

CMake脚本没有针对windows平台

ps:现在开发一个windows平台准对cos的运维工具,发现提供的库在windows平台上没法编译出

undefined reference to `boost::system::system_category(

In my machine the CMakeList.txt should be below
when you meet error

/home/app/siwenhu/cos-cpp-sdk-v4/./lib/libboost_thread.a(thread.o): In functionboost::condition_error::condition_error(int, char const*)':
thread.cpp:(.text._ZN5boost15condition_errorC2EiPKc[_ZN5boost15condition_errorC5EiPKc]+0x14): undefined reference to boost::system::system_category()' /home/app/siwenhu/cos-cpp-sdk-v4/./lib/libboost_thread.a(thread.o): In function _GLOBAL__sub_I__ZN5boost6detail16thread_data_baseD2Ev':
thread.cpp:(.text.startup+0x5): undefined reference to boost::system::generic_category()' thread.cpp:(.text.startup+0x11): undefined reference to boost::system::generic_category()'
thread.cpp:(.text.startup+0x1d): undefined reference to boost::system::system_category()' collect2: ld returned 1 exit status
you should add -mt

`
cmake_minimum_required(VERSION 2.8)
CMAKE_policy(SET CMP0015 NEW)

project(cos-cpp-sdk)
SET(BOOST_HEADER_DIR "/usr/include/boost/")
find_package(Boost REQUIRED COMPONENTS system)
include_directories(./include)
include_directories(${BOOST_HEADER_DIR})

link_directories(./lib)

option(CMAKE_BUILD_TYPE "Release")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message("debug mode")
set(CMAKE_CXX_FLAGS "$ENV{CMAKE_CXX_FLAGS} -O0 -Wall -g")
set(CMAKE_CXX_FLAGS_DEUBG "$ENV{CMAKE_CXX_FLAGS_DEUBG} -O0 -Wall -g")
else()
message("release mode")
endif()
add_subdirectory (./src)
add_executable(cos_demo cos_demo.cpp)
if (__USE_L5)
MESSAGE("use l5")
add_definitions(-D__USE_L5)
target_link_libraries(cos_demo cossdk curl ssl crypto rt jsoncpp
qos_client stdc++ pthread z boost_system boost_thread-mt)
ELSE()
target_link_libraries(cos_demo cossdk curl ssl crypto rt jsoncpp stdc++
pthread z boost_system boost_thread-mt)
ENDIF()
`

Link error on macOS

I use homebrew installed the required libraries and copy the right include file.However it throw an error on linking error with missing rt. I try to find out some solution but failed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.