【问题标题】:OAT++ installation failed on centos 7在 centos 7 上安装 OAT++ 失败
【发布时间】:2020-10-28 04:32:50
【问题描述】:

我尝试安装 OAT++。但是失败了。

操作系统信息

[root@localhost build]# cat /etc/*-release
CentOS Linux release 7.6.1810 (Core)

如何解决以下错误?

[ 84%] Building CXX object test/CMakeFiles/oatppAllTests.dir/oatpp/core/data/share/StringTemplateTest.cpp.o
/home/happyteam/jjumdong/oatpp/test/oatpp/core/data/share/StringTemplateTest.cpp: In member function 'virtual void oatpp::test::core::data::share::StringTemplateTest::onRun()':
/home/happyteam/jjumdong/oatpp/test/oatpp/core/data/share/StringTemplateTest.cpp:38:52: error: call of overloaded 'format(<brace-enclosed initializer list>)' is ambiguous
     auto result = t.format({oatpp::String("Hello")});
                                                    ^
/home/happyteam/jjumdong/oatpp/test/oatpp/core/data/share/StringTemplateTest.cpp:38:52: note: candidates are:
In file included from /home/happyteam/jjumdong/oatpp/test/oatpp/core/data/share/StringTemplateTest.cpp:27:0:
/home/happyteam/jjumdong/oatpp/src/oatpp/core/data/share/StringTemplate.hpp:175:17: note: oatpp::String oatpp::data::share::StringTemplate::format(const std::vector<oatpp::data::mapping::type::String>&) const
   oatpp::String format(const std::vector<oatpp::String>& params) const;
                 ^
/home/happyteam/jjumdong/oatpp/src/oatpp/core/data/share/StringTemplate.hpp:189:17: note: oatpp::String oatpp::data::share::StringTemplate::format(const String&) const
   oatpp::String format(const oatpp::String& singleValue) const;
                 ^

我在 ubuntu 上成功安装了 OAT++。

为什么在 centos 7 上安装 OAT++ 失败?

【问题讨论】:

    标签: oat++


    【解决方案1】:

    您的测试失败了,而不是 oatpp 库本身。
    只需通过添加 -DOATPP_BUILD_TESTS=OFF cmake 标志并重建来禁用测试:

    cmake -DOATPP_BUILD_TESTS=OFF ..
    make install
    

    修复测试:

    在文件oatpp/test/oatpp/core/data/share/StringTemplateTest 更改 所有出现的相似代码:

    auto result = t.format({oatpp::String("Hello")});
    

    auto result = t.format(std::vector<oatpp::String>({"Hello"}));
    

    如果您修复测试,请发送 PR!

    【讨论】:

      猜你喜欢
      • 2016-07-26
      • 2015-08-22
      • 2017-11-03
      • 2020-08-15
      • 2015-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-16
      相关资源
      最近更新 更多