首页 > 解决方案 > error: variable ‘use_dilation’ set but not used in building intel caffe

问题描述

I am trying to build intel caffe. I use g++ version 5.5.0.

I have error at

src/caffe/layer_factory.cpp:91:8: error: variable ‘use_dilation’ set but not used [-Werror=unused-but-set-variable]
    bool use_dilation = false;
    ^
    src/caffe/layer_factory.cpp: In instantiation of ‘boost::shared_ptr<caffe::Layer > caffe::GetConvolutionLayer(const caffe::LayerParameter&) [with Dtype = double]’:
    src/caffe/layer_factory.cpp:163:1: required from here
    src/caffe/layer_factory.cpp:91:8: error: variable ‘use_dilation’ set but not used [-Werror=unused-but-set-variable]
    cc1plus: all warnings being treated as errors
    Makefile:810: recipe for target '.build_release/src/caffe/layer_factory.o' failed
    make: *** [.build_release/src/caffe/layer_factory.o] Error 1
    make: *** Waiting for unfinished jobs....

What could be wrong?

I tried to add use_dilation = false; after the initialization. But still have error.

How can I fix that?

标签: caffe

解决方案


警告本身只是次要的。正如 Ulug Toprak 所指出的,只是有一个未使用的变量。但是你会因为这个得到一个错误:

cc1plus: all warnings being treated as errors

在 Makefile:422 中有这一行:

CXX_HARDENING_FLAGS += -fPIC -fno-operator-names -Wformat -Wformat-security -Wall -Werror

这会导致警告被视为错误。只需删除-Werror标志。


推荐阅读