• Caffe编译错误整理


    今天编译caffe-ssd遇到编译错误:

    1   Line 9690: 3>E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(141): error C2061: syntax error: identifier 'SliceLayer'
    2     Line 9690: 3>E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(141): error C2061: syntax error: identifier 'SliceLayer'
    3     Line 9696: 3>E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(262): error C2061: syntax error: identifier 'NormalizeLayer'
    4     Line 9696: 3>E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(262): error C2061: syntax error: identifier 'NormalizeLayer'
    5     Line 9702: 3>E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(272): error C2061: syntax error: identifier 'InnerProductLayer'
    6     Line 9702: 3>E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(272): error C2061: syntax error: identifier 'InnerProductLayer'
    7     Line 10141: 4>LINK : fatal error LNK1104: cannot open file '..libDebugcaffe-d.lib'

    经查,是下面文件里没有添加上面对应的三个头文件。

    添加下面三行到layer_factory.cpp:

    #include "caffe/layers/slice_layer.hpp"
    #include "caffe/layers/normalize_layer.hpp"
    #include "caffe/layers/inner_product_layer.hpp"

    再次编译,报错:

    E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(265): error C2955: 'caffe::NormalizeLayer': use of class template requires template argument list
    E:GitHubcaffe-ssd-windowsincludecaffe/layers/normalize_layer.hpp(18): note: see declaration of 'caffe::NormalizeLayer'
    E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(267): note: see reference to function template instantiation 'boost::shared_ptr<caffe::Layer<Dtype>> caffe::GetNormalizeLayer<float>(const caffe::LayerParameter &)' being compiled
     with
     [
     Dtype=float
     ]
    E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(265): error C2514: 'caffe::NormalizeLayer': class has no constructors
    E:GitHubcaffe-ssd-windowsincludecaffe/layers/normalize_layer.hpp(18): note: see declaration of 'caffe::NormalizeLayer'
    E:GitHubcaffe-ssd-windowssrccaffelayer_factory.cpp(275): error C2514: 'caffe::InnerProductLayer': class has no constructors

    查找原因:

     return shared_ptr<Layer<Dtype> >(new NormalizeLayer(param));

    改为(添加了<Dtype>):

    return shared_ptr<Layer<Dtype> >(new NormalizeLayer<Dtype>(param));

    将:

    return shared_ptr<Layer<Dtype> >(new InnerProductLayer(param));

    改为(添加了<Dtype>):

    return shared_ptr<Layer<Dtype> >(new InnerProductLayer<Dtype>(param));

    然后就编译通过了。

  • 相关阅读:
    C#和sqlserver中生成新的32位GUID
    IIS7下swfupload上传大文件出现404错误
    jQuery 判断是否为数字的方法 及 转换数字函数
    js数组与字符串的相互转换方法
    jquery 中如何将数组转化为json字符串,然后再转化回来?
    Firemonkey Android 虚拟机
    Eclipse apk 签名
    win10 修改hosts
    eclipse 预览Android界面报错
    夜神模拟器
  • 原文地址:https://www.cnblogs.com/juluwangshier/p/12386031.html
Copyright © 2020-2023  润新知