由于-Werror

时间:2015-10-14 19:13:34

标签: c++ boost casablanca

我尝试使用提升1.56构建Casablanca,但由于卡萨布兰卡的-Werror旗帜提升警告已失误,我的构建仍然失败

例如:

CXX=g++ BOOST_ROOT=${boost} cmake .. -DCMAKE_BUILD_TYPE=Release

产生错误(太多不能显示)

/home/matt/workspace/opal2/o2linux64/Libs/boost/1.56/include/boost/system/error_code.hpp:222:36: error: ‘boost::system::errno_ecat’ defined but not used [-Werror=unused-variable]
 static const error_category &  errno_ecat     = generic_category();
                                ^
/home/matt/workspace/opal2/o2linux64/Libs/boost/1.56/include/boost/system/error_code.hpp:223:36: error: ‘boost::system::native_ecat’ defined but not used [-Werror=unused-variable]
 static const error_category &  native_ecat    = system_category();
                                ^
cc1plus: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o] Error 1

我似乎无法在谷歌上找到任何补救措施,但我找到了人们使用1.56构建的帖子,并且没有提到Werror中禁用src/CMakeList.txt的帖子似乎允许代码构建)

1 个答案:

答案 0 :(得分:1)

为防止编辑Casablanca的CMakeLists.txt,您可以在运行cmake命令时添加-DWERROR = OFF参数,例如:

    var orderPrices = deliveries.reduce(function (prev, current) {
        if (prev.orderPrice)
        {
            return prev.orderPrice + current.orderPrice;
        }
        return prev + current.orderPrice;
    });

    console.log(orderPrices);

请注意,cmake可以缓存选项值,因此最好在干净的构建目录中重新运行cmake