zoukankan      html  css  js  c++  java
  • 虚函数 error LNK2001: 无法解析的外部符号 "public: virtual void __cdecl

    在虚函数后面加一对大括号

    #ifndef CAFFE_CONV_DW_LAYER_HPP_
    #define CAFFE_CONV_DW_LAYER_HPP_
    
    #include <vector>
    #include "caffe/blob.hpp"
    #include "caffe/layer.hpp"
    #include "caffe/proto/caffe.pb.h"
    
    namespace caffe {
    
    template <typename Dtype>
    class ConvolutionDepthwiseLayer : public Layer<Dtype> {
     public:
      explicit ConvolutionDepthwiseLayer(const LayerParameter& param)
          : Layer<Dtype>(param) {}
      virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
          const vector<Blob<Dtype>*>& top){};
      virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
          const vector<Blob<Dtype>*>& top){};
      virtual inline int ExactNumBottomBlobs() const { return 1; }
      virtual inline int ExactNumTopBlobs() const { return 1; }
      virtual inline const char* type() const { return "ConvolutionDepthwise"; }
     protected:
      virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
          const vector<Blob<Dtype>*>& top){};
      virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
          const vector<Blob<Dtype>*>& top){};
      virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
          const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
      virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
          const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom){};
      unsigned int kernel_h_;
      unsigned int kernel_w_;
      unsigned int stride_h_;
      unsigned int stride_w_;
      unsigned int pad_h_;
      unsigned int pad_w_;
      unsigned int dilation_h_;
      unsigned int dilation_w_;
      Blob<Dtype> weight_buffer_;
      Blob<Dtype> weight_multiplier_;
      Blob<Dtype> bias_buffer_;
      Blob<Dtype> bias_multiplier_;
    };
    
    }  // namespace caffe
    
    #endif  // CAFFE_CONV_DW_LAYER_HPP_

    $ sudo make pycaffe   出错
    CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
    python/caffe/_caffe.cpp:10:31: fatal error: numpy/arrayobject.h: No such file or directory
    compilation terminated.
    Makefile:502: recipe for target 'python/caffe/_caffe.so' failed
    make: *** [python/caffe/_caffe.so] Error 1

    Makefile.config  中   加local 

    PYTHON_INCLUDE := /usr/include/python2.7 
            /usr/local/lib/python2.7/dist-packages/numpy/core/include
    #/usr/lib/python2.7/dist-packages/numpy/core/include

    重新 make pycaffe 就可以了

  • 相关阅读:
    Laravel 中使用 Redis 数据库
    PHP 安装 phpredis 扩展(二)
    Redis 安装(一)
    macOS 中使用 phpize 动态添加 PHP 扩展的错误解决方法
    macOS 中的 Rootless 机制
    Homebrew
    macOS 下配置 MAMP 开发环境(Mac + Apache + Mysql + PHP)
    常系数齐次线性递推
    任意模数FFT
    猫树总结
  • 原文地址:https://www.cnblogs.com/crazybird123/p/10369810.html
Copyright © 2011-2022 走看看