【C++】mingw32-make+cmake:error: ‘nullptr‘ was not declared in this scope解决方法

本文介绍了如何解决在使用CMake配置项目后执行mingw32-make时遇到的C++11未被支持的问题。通过在CMakeLists.txt文件中启用C++11标准,可以避免出现诸如'nullptr'未声明等错误。

###问题
使用cmake成功(Configuring done Generating done)后,在cmd终端中执行
mingw32-make报错:

error: 'nullptr' was not declared in this scope

###原因
nullptr是在c++11的新内容。编译时,没有添加对C+11的支持。

解决方法

在Cmake中选择对CXX11的支持。
错误出现后,不用执行任何清除操作,直接在Cmake中选择ENABLE_CXX11,再次点击configure和generating。然后再cmd终端中,再次执行mingw32-make,即可。

这里写图片描述

In file included from D:/qt/Tools/mingw492_32/i686-w64-mingw32/include/c++/unordered_map:35:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:29, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/qt/Tools/mingw492_32/i686-w64-mingw32/include/c++/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support for the \ ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:27:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:45:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++0x-compat] constexpr Number abs(Number val) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:85:5: warning: identifier 'static_assert' is a keyword in C++11 [-Wc++0x-compat] static_assert(std::is_floating_point<LNumber>::value || std::is_floating_point<RNumber>::value, ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:169:9: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat] assert(len_converted != nullptr); ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:76:5: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++0x-compat] optional() noexcept ^ In file included from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:30:0: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell_reference.hpp:267:9: warning: identifier 'decltype' is a keyword in C++11 [-Wc++0x-compat] static_assert(std::is_same<decltype(x.row()), std::uint32_t>::value, "this hash function expects both row and column to be 32-bit numbers"); ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:32:0, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell_type.hpp:38:1: warning: scoped enums only available with -std=c++11 or -std=gnu++11 enum class XLNT_API cell_type ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:33:0, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:40:7: error: expected nested-name-specifier before 'row_t' using row_t = std::uint32_t; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:53:11: error: expected nested-name-specifier before 'index_t' using index_t = std::uint32_t; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:63:12: error: 'index_t' does not name a type static index_t column_index_from_string(const std::string &column_string); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:73:49: error: 'index_t' has not been declared static std::string column_string_from_index(index_t column_index); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:83:22: error: expected ')' before 'column_index' column_t(index_t column_index); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:128:21: error: 'index_t' has not been declared bool operator==(index_t other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:128:10: error: 'bool xlnt::column_t::operator==(int) const' cannot be overloaded bool operator==(index_t other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:123:10: error: with 'bool xlnt::column_t::operator==(int) const' bool operator==(int other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:148:21: error: 'index_t' has not been declared bool operator!=(index_t other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:148:10: error: 'bool xlnt::column_t::operator!=(int) const' cannot be overloaded bool operator!=(index_t other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:143:10: error: with 'bool xlnt::column_t::operator!=(int) const' bool operator!=(int other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:183:36: error: 'index_t' in 'class xlnt::column_t' does not name a type bool operator>(const column_t::index_t &other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:188:37: error: 'index_t' in 'class xlnt::column_t' does not name a type bool operator>=(const column_t::index_t &other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:193:36: error: 'index_t' in 'class xlnt::column_t' does not name a type bool operator<(const column_t::index_t &other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:198:37: error: 'index_t' in 'class xlnt::column_t' does not name a type bool operator<=(const column_t::index_t &other) const; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:243:52: error: 'index_t' in 'class xlnt::column_t' does not name a type friend XLNT_API bool operator>(const column_t::index_t &left, const column_t &right); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:248:53: error: 'index_t' in 'class xlnt::column_t' does not name a type friend XLNT_API bool operator>=(const column_t::index_t &left, const column_t &right); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:253:52: error: 'index_t' in 'class xlnt::column_t' does not name a type friend XLNT_API bool operator<(const column_t::index_t &left, const column_t &right); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:258:53: error: 'index_t' in 'class xlnt::column_t' does not name a type friend XLNT_API bool operator<=(const column_t::index_t &left, const column_t &right); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:268:5: error: 'index_t' does not name a type index_t index; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:271:1: warning: scoped enums only available with -std=c++11 or -std=gnu++11 enum class row_or_col_t : int ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:271:27: warning: scoped enums only available with -std=c++11 or -std=gnu++11 enum class row_or_col_t : int ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:297:8: error: 'hash' is not a class template struct hash<xlnt::column_t> ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/index_types.hpp:298:1: error: explicit specialization of non-template 'std::hash' { ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:30:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/phonetic_run.hpp:38:5: error: 'uint32_t' does not name a type uint32_t start; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/phonetic_run.hpp:39:5: error: 'uint32_t' does not name a type uint32_t end; ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:26:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:50:36: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 exception(const exception &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:55:16: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~exception() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:55:5: error: looser throw specifier for 'virtual xlnt::exception::~exception()' ~exception() override; ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:28:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:26, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/qt/Tools/mingw492_32/i686-w64-mingw32/include/c++/stdexcept:121:13: error: overriding 'virtual std::runtime_error::~runtime_error() throw ()' virtual ~runtime_error() _GLIBCXX_USE_NOEXCEPT; ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:26:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:89:52: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 invalid_parameter(const invalid_parameter &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:94:24: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~invalid_parameter() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:111:56: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 invalid_sheet_title(const invalid_sheet_title &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:116:26: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~invalid_sheet_title() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:134:42: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 invalid_file(const invalid_file &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:139:19: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~invalid_file() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:157:52: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 illegal_character(const illegal_character &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:162:24: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~illegal_character() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:179:52: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 invalid_data_type(const invalid_data_type &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:184:24: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~invalid_data_type() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:201:58: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 invalid_column_index(const invalid_column_index &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:206:27: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~invalid_column_index() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:218:45: error: 'row_t' has not been declared invalid_cell_reference(column_t column, row_t row); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:228:62: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 invalid_cell_reference(const invalid_cell_reference &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:233:29: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~invalid_cell_reference() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:250:52: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 invalid_attribute(const invalid_attribute &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:255:24: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~invalid_attribute() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:272:44: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 key_not_found(const key_not_found &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:277:20: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~key_not_found() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:294:60: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 no_visible_worksheets(const no_visible_worksheets &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:299:28: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~no_visible_worksheets() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:316:60: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 unhandled_switch_case(const unhandled_switch_case &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:321:28: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~unhandled_switch_case() override; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:339:40: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 unsupported(const unsupported &) = default; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/exceptions.hpp:344:18: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 ~unsupported() override; ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:27:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:45:1: error: 'constexpr' does not name a type constexpr Number abs(Number val) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:45:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:54:1: error: 'constexpr' does not name a type constexpr typename std::common_type<NumberL, NumberR>::type (max)(NumberL lval, NumberR rval) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:54:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:63:1: error: 'constexpr' does not name a type constexpr typename std::common_type<NumberL, NumberR>::type (min)(NumberL lval, NumberR rval) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:63:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:80:27: error: no default argument for 'LNumber' int epsilon_scale = 20) // scale the "fuzzy" equality. Higher value gives a more tolerant comparison ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:80:27: error: no default argument for 'RNumber' D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:80:27: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11 D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp: In function 'bool xlnt::detail::float_equals(const LNumber&, const RNumber&, int)': D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:83:11: error: expected nested-name-specifier before 'common_t' using common_t = typename std::common_type<LNumber, RNumber>::type; ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:85:19: error: 'is_floating_point' is not a member of 'std' static_assert(std::is_floating_point<LNumber>::value || std::is_floating_point<RNumber>::value, ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:85:49: error: expected primary-expression before '>' token static_assert(std::is_floating_point<LNumber>::value || std::is_floating_point<RNumber>::value, ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:85:50: error: '::value' has not been declared static_assert(std::is_floating_point<LNumber>::value || std::is_floating_point<RNumber>::value, ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:85:61: error: 'is_floating_point' is not a member of 'std' static_assert(std::is_floating_point<LNumber>::value || std::is_floating_point<RNumber>::value, ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:85:91: error: expected primary-expression before '>' token static_assert(std::is_floating_point<LNumber>::value || std::is_floating_point<RNumber>::value, ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:85:92: error: '::value' has not been declared static_assert(std::is_floating_point<LNumber>::value || std::is_floating_point<RNumber>::value, ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:86:77: error: there are no arguments to 'static_assert' that depend on a template parameter, so a declaration of 'static_assert' must be available [-fpermissive] "Using this function with two integers is just wasting time. Use =="); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:86:77: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:87:76: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 static_assert(std::numeric_limits<EpsilonType>::epsilon() < EpsilonType{1}, ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:98:5: error: 'constexpr' was not declared in this scope constexpr common_t epsilon = static_cast<common_t>(std::numeric_limits<EpsilonType>::epsilon()); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:103:5: error: 'common_t' was not declared in this scope common_t scaled_fuzz = epsilon_scale * epsilon * max(max(xlnt::detail::abs<common_t>(lhs), ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:105:43: error: expected primary-expression before ')' token common_t{1}); // clamp ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:106:20: error: 'scaled_fuzz' was not declared in this scope return ((lhs + scaled_fuzz) >= rhs) && ((rhs + scaled_fuzz) >= lhs); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp: At global scope: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:111:12: error: 'constexpr' does not name a type static constexpr int Excel_Digit_Precision = 15; //sf ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:111:12: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 In file included from D:/qt/Tools/mingw492_32/i686-w64-mingw32/include/c++/cassert:43:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:28, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:27, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp: In member function 'double xlnt::detail::number_serialiser::deserialise(const string&, ptrdiff_t*) const': D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:169:33: error: 'nullptr' was not declared in this scope assert(len_converted != nullptr); ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:27:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:179:9: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat] auto copy_end = std::copy(s.begin(), s.end(), buf); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:179:14: error: 'copy_end' does not name a type auto copy_end = std::copy(s.begin(), s.end(), buf); ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/numeric.hpp:180:54: error: 'copy_end' was not declared in this scope convert_pt_to_comma(buf, static_cast<size_t>(copy_end - buf)); ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp: At global scope: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:57:45: error: 'enable_if' in namespace 'std' does not name a template type template <typename U = T, typename std::enable_if<!std::is_floating_point<U>::value>::type * = nullptr> ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:57:54: error: expected '>' before '<' token template <typename U = T, typename std::enable_if<!std::is_floating_point<U>::value>::type * = nullptr> ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:58:5: error: 'constexpr' does not name a type constexpr bool compare_equal(const U &lhs, const U &rhs) const ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:58:5: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:66:45: error: 'enable_if' in namespace 'std' does not name a template type template <typename U = T, typename std::enable_if<std::is_floating_point<U>::value>::type * = nullptr> ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:66:54: error: expected '>' before '<' token template <typename U = T, typename std::enable_if<std::is_floating_point<U>::value>::type * = nullptr> ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:67:5: error: 'constexpr' does not name a type constexpr bool compare_equal(const U &lhs, const U &rhs) const ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:67:5: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:76:14: error: expected ';' at end of member declaration optional() noexcept ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:76:16: error: 'noexcept' does not name a type optional() noexcept ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:85:28: error: expected ';' at end of member declaration optional(const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_copy_T_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:41: error: expected identifier before '(' token #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:85:39: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_copy_T_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:42: error: expected ')' before 'false' #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:85:39: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_copy_T_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:42: error: expected ')' before 'false' #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:85:39: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_copy_T_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:41: error: expected ';' at end of member declaration #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:85:39: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_copy_T_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:42: error: expected unqualified-id before 'false' #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:85:39: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_copy_T_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:95:16: error: expected ',' or '...' before '&&' token optional(T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_move_T_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:95:23: error: expected ';' at end of member declaration optional(T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_move_T_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:41: error: expected identifier before '(' token #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:95:34: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_move_T_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:42: error: expected ')' before 'false' #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:95:34: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_move_T_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:42: error: expected ')' before 'false' #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:95:34: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_move_T_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:41: error: expected ';' at end of member declaration #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:95:34: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_move_T_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:95:25: error: 'int xlnt::optional<T>::noexcept(...)' cannot be overloaded optional(T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_move_T_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:85:30: error: with 'int xlnt::optional<T>::noexcept(...)' optional(const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_copy_T_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:42: error: expected unqualified-id before 'false' #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:95:34: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_move_T_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:105:35: error: expected ';' at end of member declaration optional(const optional &other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(copy_ctor_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:41: error: expected identifier before '(' token #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:105:46: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const optional &other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(copy_ctor_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:42: error: expected ')' before 'false' #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:105:46: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const optional &other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(copy_ctor_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:42: error: expected ')' before 'false' #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:105:46: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const optional &other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(copy_ctor_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:41: error: expected ';' at end of member declaration #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:105:46: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const optional &other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(copy_ctor_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:105:37: error: 'int xlnt::optional<T>::noexcept(...)' cannot be overloaded optional(const optional &other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(copy_ctor_noexcept{})) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:85:30: error: with 'int xlnt::optional<T>::noexcept(...)' optional(const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_copy_T_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:43:42: error: expected unqualified-id before 'false' #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:105:46: note: in expansion of macro 'XLNT_NOEXCEPT_VALUE_COMPAT' optional(const optional &other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(copy_ctor_noexcept{})) ^ In file included from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/color.hpp:31:0, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/styles/font.hpp:30, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text_run.hpp:29, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/rich_text.hpp:31, from D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/cell/cell.hpp:34, from D:\luoyu\xlnt-master测试有效\xlnt-master\xlnt-master\source\cell\cell.cpp:29: D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:186:28: error: expected '}' before end of line #pragma GCC diagnostic push ^ D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:186:28: error: expected unqualified-id before end of line D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:186:28: error: expected '}' before end of line D:/luoyu/xlnt-master测试有效/xlnt-master/xlnt-master/source/../include/xlnt/utils/optional.hpp:186:28: error: expected declaration before end of line CMakeFiles\xlnt.dir\build.make:54: recipe for target 'CMakeFiles/xlnt.dir/cell/cell.cpp.obj' failed mingw32-make[2]: *** [CMakeFiles/xlnt.dir/cell/cell.cpp.obj] Error 1 CMakeFiles\Makefile2:90: recipe for target 'CMakeFiles/xlnt.dir/all' failed mingw32-make[1]: *** [CMakeFiles/xlnt.dir/all] Error 2 makefile:116: recipe for target 'all' failed mingw32-make: *** [all] Error 2
08-02
capturerunner.h 如下 #ifndef CAPTURERUNNER_H #define CAPTURERUNNER_H #include <thread> #include <atomic> #include "../common/XThreadPool.h" #include "../logger/logger.h" extern "C" { #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> #include <libavutil/fifo.h> } #define min_time_interval 40 struct CaptureRunnerParam { Capture* capt; // 视频捕获对象指针 AVFifo* fifo; // AVFifo帧数据队列 }; class CaptureRunner : public XTask { public: int Init(void* param); void Deinit(void); int Start(int time); int Stop(void); int Run(); private: std::atomic<bool> m_is_running; Logger::ptr m_logger; Capture* m_capt; AVFifo* m_fifo; int m_time_interval; }; #endif // CAPTURERUNNER_H capturerunner.cpp如下 #include "capturerunner.h" #include <chrono> using namespace std; int CaptureRunner::Init(void* param) { CaptureRunnerParam* c = (CaptureRunnerParam*)param; this->m_capt = c->capt; this->m_fifo = c->fifo; this->m_logger = DefaultLogger(); return 0; } void CaptureRunner::Deinit() { if(m_is_running) { this->Stop(); } return; } int CaptureRunner::Start(int time) { this->m_time_interval = time; Run(); return 0; } int CaptureRunner::Stop() { m_is_running = false; return 0; } int CaptureRunner::Run() { if(m_is_running) { m_logger->Error("Running now"); return -1; } m_is_running = true; int ret = 0; while(m_is_running) { AVFrame* frame = m_capt->CaptureFrame(); if(!frame) { m_logger->Error("readfile failed"); this_thread::sleep_for(chrono::seconds(1)); continue; } // 将帧写入AVFifo ret = av_fifo_write(m_fifo, &frame, 1); if(ret < 0) { m_logger->Error("write to fifo failed"); av_frame_free(&frame); continue; } if(m_time_interval > min_time_interval) { this_thread::sleep_for(chrono::milliseconds(m_time_interval)); } else { this_thread::sleep_for(chrono::milliseconds(min_time_interval)); } } return 0; } capt_test.cpp如下 #include <signal.h> #include <atomic> #include "../common/XThreadPool.h" #include "test.h" #include "../capt/capture.h" #include "../capt/capturerunner.h" extern "C" { #include <libavutil/fifo.h> #include <libavutil/imgutils.h> } using namespace std; Logger::ptr Logger2 = DefaultLogger(); class capt_write : public XTask { public: int Run(); void Stop(); int Init(CaptureRunnerParam* param); void Deinit(); atomic<bool> is_running; AVFifo* fifo; FILE* fp; AVPixelFormat pix_fmt; int width, height; }; int capt_write::Init(CaptureRunnerParam* par) { this->fifo = par->fifo; this->fp = fopen("/home/kylin/zxk/test20241029/output.yuv", "wb"); if(!fp) { Logger2->Error("Failed to open output file"); return -1; } // 从捕获对象获取参数 this->width = par->capt->m_width; this->height = par->capt->m_height; this->pix_fmt = par->capt->m_pixel_fmt; return 0; } int capt_write::Run() { if(is_running) { Logger2->Error("Running now"); return -1; } is_running = true; while(is_running) { if(av_fifo_can_read(fifo) <= 0) { Logger2->Warning("Fifo empty"); this_thread::sleep_for(chrono::seconds(1)); continue; } AVFrame* frame = nullptr; av_fifo_read(fifo, &frame, 1); if(!frame) { Logger2->Warning("frame is NULL"); continue; } // 计算各分量大小 size_t y_bytes = width * height; size_t u_bytes = 0, v_bytes = 0; switch(pix_fmt) { case AV_PIX_FMT_YUYV422: y_bytes = width * height * 2; // YUYV packed格式 break; case AV_PIX_FMT_YUV420P: u_bytes = width * height / 4; v_bytes = width * height / 4; break; case AV_PIX_FMT_BGR0: y_bytes = width * height * 4; // BGR0 packed格式 break; } // 写入文件 fwrite(frame->data[0], 1, y_bytes, fp); if(u_bytes > 0) fwrite(frame->data[1], 1, u_bytes, fp); if(v_bytes > 0) fwrite(frame->data[2], 1, v_bytes, fp); av_frame_free(&frame); } return 0; } void capt_write::Deinit() { if(is_running) { Stop(); } if(fp) { fclose(fp); } } void capt_write::Stop() { is_running = false; } bool stop2 = false; void sigint_handler02(int sig_num) { stop2 = true; } // 初始化V4L2捕获参数 void init_v4l2(CaptParam& c) { c.width = 1280; c.height = 720; c.file_name = "/dev/video0"; c.pixel_fmt = AV_PIX_FMT_YUYV422; c.v4l2_buffer_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; c.v4l2_memory_type = V4L2_MEMORY_MMAP; c.v4l2_pixel_fmt = V4L2_PIX_FMT_YUYV; } // 初始化文件捕获参数 void init_file(CaptParam& c) { c.file_name = "/home/kylin/zxk/test20241021/testyuv.yuv"; c.width = 1280; c.height = 720; c.pixel_fmt = AV_PIX_FMT_YUV420P; } // 初始化屏幕捕获参数 void init_screen(CaptParam& c) { c.width = 1920; c.height = 1080; c.pixel_fmt = AV_PIX_FMT_BGR0; } int capt_test() { CaptParam c; // 选择一种捕获方式初始化 (取消注释对应的行) //init_v4l2(c); // V4L2捕获 init_file(c); // 文件捕获 //init_screen(c); // 屏幕捕获 // 创建AVFifo AVFifo* fifo = av_fifo_alloc2(10 * 1024 * 1024, 1, 0); // 10MB缓冲区 // 创建捕获对象 (与上面选择的初始化方式对应) //Capture* capt = new V4L2Capture; Capture* capt = new FileCapture; //Capture* capt = new ScreenCapture; capt->Init(&c); // 设置任务参数 CaptureRunnerParam param; param.capt = capt; param.fifo = fifo; // 创建任务 auto c1 = make_shared<CaptureRunner>(); auto c2 = make_shared<capt_write>(); c1->Init(&param); c2->Init(&param); // 启动线程池 XThreadPool pool; pool.Init(2); pool.Start(); pool.AddTask(c1); pool.AddTask(c2); // 主循环 signal(SIGINT, sigint_handler02); signal(SIGKILL, sigint_handler02); while(!stop2) { this_thread::sleep_for(chrono::milliseconds(100)); } // 清理 c2->Deinit(); this_thread::sleep_for(chrono::milliseconds(1000)); c1->Deinit(); capt->Deinit(); av_fifo_freep2(&fifo); pool.Stop(); return 0; } CMakeLists.txt 如下 cmake_minimum_required(VERSION 3.15) project(CaptureTest) set(CMAKE_CXX_STANDARD 11) #添加头文件搜索路径 include_directories( ${CMAKE_SOURCE_DIR}/include /home/zhanghan/include /home/zhanghan/Log/Log-lib/include /usr/local/include ) #添加静态库路径 link_directories( /home/zhanghan/Log ) # 查找FFmpeg相关库 find_package(PkgConfig REQUIRED) pkg_check_modules(FFMPEG REQUIRED libavcodec libavformat libavutil libswscale libavdevice ) # 添加FFmpeg头文件 include_directories(${FFMPEG_INCLUDE_DIRS}) # 所有源文件 set(SOURCES main.cpp capt_test.cpp ../logger/logger.cpp ../logger/formatter.cpp ../logger/logsink.cpp ../logger/asynlopper.cpp ../capt/capturerunner.cpp ../capt/capture.cpp ../common/XThreadPool.cpp ../capt/ScreenCapture.cpp ../capt/V4L2Capture.cpp ../capt/FileCapture.cpp ) add_executable(capture_test ${SOURCES}) # 链接库 target_link_libraries(capture_test pthread ${FFMPEG_LIBRARIES} log ) 错误信息如下 zhanghan@zhanghan-virtual-machine:~/daima/2/test2/build$ make -- Configuring done -- Generating done -- Build files have been written to: /home/zhanghan/daima/2/test2/build Consolidate compiler generated dependencies of target capture_test [ 7%] Building CXX object CMakeFiles/capture_test.dir/capt_test.cpp.o In file included from /home/zhanghan/daima/2/test2/capt_test.cpp:6: /home/zhanghan/daima/2/test2/../capt/capturerunner.h:19:5: error: ‘AVFifo’ does not name a type 19 | AVFifo* fifo; // AVFifo帧数据队列 | ^~~~~~ /home/zhanghan/daima/2/test2/../capt/capturerunner.h:34:5: error: ‘AVFifo’ does not name a type 34 | AVFifo* m_fifo; | ^~~~~~ /home/zhanghan/daima/2/test2/capt_test.cpp:25:5: error: ‘AVFifo’ does not name a type 25 | AVFifo* fifo; | ^~~~~~ /home/zhanghan/daima/2/test2/capt_test.cpp: In member function ‘int capt_write::Init(CaptureRunnerParam*)’: /home/zhanghan/daima/2/test2/capt_test.cpp:32:11: error: ‘class capt_write’ has no member named ‘fifo’ 32 | this->fifo = par->fifo; | ^~~~ /home/zhanghan/daima/2/test2/capt_test.cpp:32:23: error: ‘struct CaptureRunnerParam’ has no member named ‘fifo’ 32 | this->fifo = par->fifo; | ^~~~ /home/zhanghan/daima/2/test2/capt_test.cpp:40:30: error:int Capture::m_width’ is protected within this context 40 | this->width = par->capt->m_width; | ^~~~~~~ In file included from /home/zhanghan/daima/2/test2/capt_test.cpp:5: /home/zhanghan/daima/2/test2/../capt/capture.h:87:9: note: declared protected here 87 | int m_width; | ^~~~~~~ /home/zhanghan/daima/2/test2/capt_test.cpp:40:30: note: field ‘int Capture::m_width’ can be accessed via ‘int Capture::GetWidth() const’ 40 | this->width = par->capt->m_width; | ^~~~~~~ | GetWidth() /home/zhanghan/daima/2/test2/capt_test.cpp:41:31: error:int Capture::m_height’ is protected within this context 41 | this->height = par->capt->m_height; | ^~~~~~~~ In file included from /home/zhanghan/daima/2/test2/capt_test.cpp:5: /home/zhanghan/daima/2/test2/../capt/capture.h:88:9: note: declared protected here 88 | int m_height; | ^~~~~~~~ /home/zhanghan/daima/2/test2/capt_test.cpp:41:31: note: field ‘int Capture::m_height’ can be accessed via ‘int Capture::GetHeight() const’ 41 | this->height = par->capt->m_height; | ^~~~~~~~ | GetHeight() /home/zhanghan/daima/2/test2/capt_test.cpp:42:32: error: ‘AVPixelFormat Capture::m_pixel_fmt’ is protected within this context 42 | this->pix_fmt = par->capt->m_pixel_fmt; | ^~~~~~~~~~~ In file included from /home/zhanghan/daima/2/test2/capt_test.cpp:5: /home/zhanghan/daima/2/test2/../capt/capture.h:89:19: note: declared protected here 89 | AVPixelFormat m_pixel_fmt; | ^~~~~~~~~~~ /home/zhanghan/daima/2/test2/capt_test.cpp:42:32: note: field ‘AVPixelFormat Capture::m_pixel_fmt’ can be accessed via ‘AVPixelFormat Capture::GetPixelFmt() const’ 42 | this->pix_fmt = par->capt->m_pixel_fmt; | ^~~~~~~~~~~ | GetPixelFmt() /home/zhanghan/daima/2/test2/capt_test.cpp: In member function ‘virtual int capt_write::Run()’: /home/zhanghan/daima/2/test2/capt_test.cpp:55:29: error: ‘fifo’ was not declared in this scope; did you mean ‘mkfifo’? 55 | if(av_fifo_can_read(fifo) <= 0) { | ^~~~ | mkfifo /home/zhanghan/daima/2/test2/capt_test.cpp:55:12: error: ‘av_fifo_can_read’ was not declared in this scope; did you mean ‘av_fifo_generic_read’? 55 | if(av_fifo_can_read(fifo) <= 0) { | ^~~~~~~~~~~~~~~~ | av_fifo_generic_read /home/zhanghan/daima/2/test2/capt_test.cpp:62:22: error: ‘fifo’ was not declared in this scope; did you mean ‘mkfifo’? 62 | av_fifo_read(fifo, &frame, 1); | ^~~~ | mkfifo /home/zhanghan/daima/2/test2/capt_test.cpp:62:9: error: ‘av_fifo_read’ was not declared in this scope; did you mean ‘avio_read’? 62 | av_fifo_read(fifo, &frame, 1); | ^~~~~~~~~~~~ | avio_read /home/zhanghan/daima/2/test2/capt_test.cpp: In function ‘int capt_test()’: /home/zhanghan/daima/2/test2/capt_test.cpp:149:5: error: ‘AVFifo’ was not declared in this scope 149 | AVFifo* fifo = av_fifo_alloc2(10 * 1024 * 1024, 1, 0); // 10MB缓冲区 | ^~~~~~ /home/zhanghan/daima/2/test2/capt_test.cpp:149:13: error: ‘fifo’ was not declared in this scope; did you mean ‘mkfifo’? 149 | AVFifo* fifo = av_fifo_alloc2(10 * 1024 * 1024, 1, 0); // 10MB缓冲区 | ^~~~ | mkfifo /home/zhanghan/daima/2/test2/capt_test.cpp:149:20: error: ‘av_fifo_alloc2’ was not declared in this scope; did you mean ‘av_fifo_alloc’? 149 | AVFifo* fifo = av_fifo_alloc2(10 * 1024 * 1024, 1, 0); // 10MB缓冲区 | ^~~~~~~~~~~~~~ | av_fifo_alloc /home/zhanghan/daima/2/test2/capt_test.cpp:161:11: error: ‘struct CaptureRunnerParam’ has no member named ‘fifo’ 161 | param.fifo = fifo; | ^~~~ /home/zhanghan/daima/2/test2/capt_test.cpp:188:5: error: ‘av_fifo_freep2’ was not declared in this scope; did you mean ‘av_fifo_freep’? 188 | av_fifo_freep2(&fifo); | ^~~~~~~~~~~~~~ | av_fifo_freep 如何解决
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

郭老二

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值