-
Notifications
You must be signed in to change notification settings - Fork 89
Description
1.错误信息: error: ‘Reader’ is deprecated:
原因: JSON库比较老, 有些方法已经过期, CMake编译参数里添加了-Werror, 警告当作错误, 停止编译
解决: 如果不想去改代码, 就可以在根目录的CMakeLists.txt文件, 在list(APPEND SDK_COMPILER_FLAGS "-std=c++11")添加list(APPEND SDK_COMPILER_FLAGS "-Wno-deprecated-declarations")
2.错误信息: error: loop variable ‘rule’ creates a copy from type ‘const AlibabaCloud::OSS::LifecycleRule’
原因: 添加了-Werror=range-loop-construct, 在循环中出现的复制, 会当作错误, 停止编译
解决: 删除这个提示(不推荐), 但会导致循环内存增长。或者根据提示修改代码, 只需要在循环变量之前加上&即可(推荐)
1.Error Message: error: ‘Reader’ is deprecated:
Cause: The JSON library is quite old, and some methods have been deprecated. The CMake compile parameter -Werror is added, which treats warnings as errors, stopping the compilation.
Solution: If you don't want to modify the code, you can add list(APPEND SDK_COMPILER_FLAGS "-Wno-deprecated-declarations") after list(APPEND SDK_COMPILER_FLAGS "-std=c++11") in the CMakeLists.txt file in the root directory.
2.Error Message: error: loop variable ‘rule’ creates a copy from type ‘const AlibabaCloud::OSS::LifecycleRule’
Cause: The -Werror=range-loop-construct flag is added, and any copying inside loops will be treated as an error, stopping the compilation.
Solution: You can remove this warning (not recommended), but it will cause memory growth in the loop. Alternatively, you can modify the code as suggested by the compiler, simply by adding & before the loop variable (recommended).