此错误是我在添加convLSTM层中,在caffe工程中编译(make)时出现的错误,希望对大家有借鉴作用
第一个错误
src/caffe/layers/dummy_forward.cpp:17:34: error: in C++98 'dummy_shape' must be initialized by constructor, not by '{...}'
std::vector<int> dummy_shape {1}
.....................................................................(等)
Makefile:605: recipe for target '.build_release/src/caffe/layers/conv_lstm_layer.o' failed
make: *** [.build_release/src/caffe/layers/conv_lstm_layer.o] Error 1
第二个错误
./include/caffe/layers/conv_lstm_helper.hpp:88:12: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
for( auto b : bottom )
^
./include/caffe/layers/conv_lstm_helper.hpp:88:17: error: 'b' does not name a type
for( auto b : bottom )
......................................(等)
Makefile:605: recipe for target '.build_release/src/caffe/layers/conv_lstm_unit_layer.o' failed
make: *** [.build_release/src/caffe/layers/conv_lstm_unit_layer.o] Error 1
报错原因
要使用c++11编译
解决方法
在所需编译的caffe项目的Makefile.config中将
# CUSTOM_CXX := g++替换为CUSTOM_CXX := g++ -std=c++11(第25行,注意:去掉 # )
至于在caffe中添加其他网络层(别人编写的或者自己写的)方式,没有实践,请参看他人解决方法,本文仅供参考,希望对各位有用。