Release X64平台

createdll.h
#ifndef CREARDLL_H_
#define CREARDLL_H_

extern "C" _declspec(dllexport) int add(int x, int y);/*_declspec(dllexport)声明一个导出函数,是说这个函数要从本DLL导出,我要给别人用。*/
int add(int x, int y);  //求和函数

#endif

createdll.cpp
#include"stdafx.h"  //注意不要忘了添加这个头文件
#include"creatdll.h"
#include<iostream>

int add(int x, int y)
{
    return x + y;
}

调用
#include<iostream>
#pragma comment(lib,"makeDLL.lib")

_declspec(dllimport) int add(int x, int y); //_declspec(dllimport)声明一个导入函数,是说这个函数是从别的DLL导入,我要用。

int main()
{
    std::cout << "2 + 3 = " << add(2, 3) << std::endl;

std::cin.get();
    return 0;
}

#define CPU_ONLY

包含目录:
F:\caffe-windows\include

F:\NugetPackages\boost.1.59.0.0\lib\native\include

F:\NugetPackages\glog.0.3.3.0\build\native\include

F:\NugetPackages\gflags.2.1.2.1\build\native\include

F:\NugetPackages\protobuf-v120.2.6.1\build\native\include

F:\NugetPackages\OpenBLAS.0.2.14.1\lib\native\include

F:\NugetPackages\OpenCV.2.4.10\build\native\include

E:\fengzhuangku\caffeConfigure\include\caffe

E:\fengzhuangku\caffeConfigure\include\caffe\layers

库目录:
F:\NugetPackages\lmdb-v120-clean.0.9.14.0\lib\native\lib\x64

F:\NugetPackages\LevelDB-vc120.1.2.0.0\build\native\lib\x64\v120\Release

F:\NugetPackages\OpenCV.2.4.10\build\native\lib\x64\v120\Release

F:\caffe-windows\Build\x64\Release

F:\opencv2.4.10\build\x64\vc12\lib

F:\NugetPackages\boost_date_time-vc120.1.59.0.0\lib\native\address-model-64\lib

F:\NugetPackages\boost_filesystem-vc120.1.59.0.0\lib\native\address-model-64\lib

F:\NugetPackages\boost_system-vc120.1.59.0.0\lib\native\address-model-64\lib

F:\NugetPackages\glog.0.3.3.0\build\native\lib\x64\v120\Release\dynamic

F:\NugetPackages\boost_thread-vc120.1.59.0.0\lib\native\address-model-64\lib

F:\NugetPackages\boost_chrono-vc120.1.59.0.0\lib\native\address-model-64\lib

F:\NugetPackages\gflags.2.1.2.1\build\native\x64\v120\static\Lib

F:\NugetPackages\hdf5-v120-complete.1.8.15.2\lib\native\lib\x64

F:\NugetPackages\protobuf-v120.2.6.1\build\native\lib\x64\v120\Release

F:\NugetPackages\OpenBLAS.0.2.14.1\lib\native\lib\x64

E:\fengzhuangku\caffeConfigure\lib   (libcaffe)

连接库
libboost_date_time-vc120-mt-1_59.lib
libboost_filesystem-vc120-mt-1_59.lib
libboost_system-vc120-mt-1_59.lib
libglog.lib
libcaffe.lib
gflags.lib
gflags_nothreads.lib
hdf5.lib
hdf5_hl.lib
libprotobuf.lib
libopenblas.dll.a
Shlwapi.lib
LevelDb.lib
lmdb.lib

E:\opencversiyio\build\x64\vc12\lib\opencv_video2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_objdetect2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_core2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_highgui2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_imgproc2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_ts2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_nonfree2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_ocl2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_photo2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_stitching2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_superres2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_videostab2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_calib3d2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_contrib2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_features2d2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_flann2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_gpu2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_legacy2410.lib
E:\opencversiyio\build\x64\vc12\lib\opencv_ml2410.lib

//注册问题

#include "caffe/common.hpp" 
#include "caffe/layers/input_layer.hpp" 
#include "caffe/layers/inner_product_layer.hpp" 
#include "caffe/layers/dropout_layer.hpp" 
#include "caffe/layers/conv_layer.hpp" 
#include "caffe/layers/relu_layer.hpp"

#include "caffe/layers/pooling_layer.hpp" 
#include "caffe/layers/lrn_layer.hpp" 
#include "caffe/layers/softmax_layer.hpp" 
#include "caffe/layers/normalize_layer.hpp"
#include "caffe/layers/permute_layer.hpp"
#include "caffe/layers/flatten_layer.hpp"
#include "caffe/layers/prior_box_layer.hpp"
#include "caffe/layers/concat_layer.hpp"
#include "caffe/layers/reshape_layer.hpp"
#include "caffe/layers/softmax_layer.hpp"
#include "caffe/layers/detection_output_layer.hpp"

namespace caffe
{
extern INSTANTIATE_CLASS(InputLayer);
extern INSTANTIATE_CLASS(ConvolutionLayer);
REGISTER_LAYER_CLASS(Convolution);
extern INSTANTIATE_CLASS(InnerProductLayer);
extern INSTANTIATE_CLASS(DropoutLayer);
extern INSTANTIATE_CLASS(ReLULayer);
REGISTER_LAYER_CLASS(ReLU);
extern INSTANTIATE_CLASS(PoolingLayer);
REGISTER_LAYER_CLASS(Pooling);
extern INSTANTIATE_CLASS(LRNLayer);
//REGISTER_LAYER_CLASS(LRN);
extern INSTANTIATE_CLASS(SoftmaxLayer);
//REGISTER_LAYER_CLASS(Softmax);
extern INSTANTIATE_CLASS(NormalizeLayer);
//REGISTER_LAYER_CLASS(Normalize);
extern INSTANTIATE_CLASS(PermuteLayer);
//REGISTER_LAYER_CLASS(Permute);
extern INSTANTIATE_CLASS(FlattenLayer);
extern INSTANTIATE_CLASS(PriorBoxLayer);
extern INSTANTIATE_CLASS(ConcatLayer);
extern INSTANTIATE_CLASS(ReshapeLayer);
extern INSTANTIATE_CLASS(SoftmaxLayer);
REGISTER_LAYER_CLASS(Softmax);
extern INSTANTIATE_CLASS(DetectionOutputLayer);
}

#endif

这时还会遇到一个麻烦的问题,添加了REGISTER_LAYER_CLASS()他会报重复注册,去掉这一句又报不认识这一层。
在layer_factory.hpp里做如下更改可以解决这个问题:

把static void AddCreator(const string& type, Creator creator){}里的:
    CHECK_EQ(registry.count(type), 0)<< "Layer type " << type << " already registered.";
    registry[type] = creator;

改为:

if (registry.count(type) != 0)
{
std::cout<< "Layer type " << type << " already registered.     ";
}
else
{
registry[type] = creator;
}
这样就能确保只注册一次了。

测试库

把编译生成的dll和lib库拷贝到测试工程中。配置库,运行需要dll库

caffe 动态库 Release X64的更多相关文章

  1. 【VS工程设置】 编译动态库,命令行添加参数,不使用预编译头,指定该项目链接 哪种 运行库

    编译动态库 注意: 动态库: [目标文件扩展] => .dll + [配置类型] => 动态库(.dll) 静态库: [目标文件扩展] => .lib + [ 配置类型]=> ...

  2. 最全Windows版本jemalloc库(5.2.1)及其使用:包含动态库和静态库、x86版本和x64版本、debug版本和release版本

    编写服务器程序时,需要频繁的申请和释放内存,长时间运行会产生大量的内存碎片,这就导致即使当前系统中的闲置内存还足够多,但也无法申请到大的连续可用的内存块,因为此时的物理内存已经千疮百孔像个马蜂窝.此外 ...

  3. faster_rcnn c++版本的 caffe 封装,动态库(2)

    摘要: 转载请注明出处,楼燚(yì)航的blog,http://www.cnblogs.com/louyihang-loves-baiyan/ github上的代码链接,求给星星:) https:// ...

  4. Unity跨平台C/CPP动态库编译---可靠UDP网络库kcp基于CMake的各平台构建实践

    1.为什么需要动态库 a)提供原生代码(native code)的支持,也叫原生插件,但是我实践的是c/cpp跨平台动态库,这里不具体涉及安卓平台java库和ios平台的objectc库构建. b)某 ...

  5. c++动态库封装及调用(3、windows下动态库调用)

    1.DLL的隐式调用 隐式链接采用静态加载的方式,比较简单,需要.h..lib..dll三件套.新建“控制台应用程序”或“空项目”.配置如下: 项目->属性->配置属性->VC++ ...

  6. 详解UE4静态库与动态库的导入与使用

    转自:http://blog.csdn.net/u012999985/article/details/71554628 一.基本内容概述   最近做项目时经常看到build.cs文件,就想研究一下UE ...

  7. 在VS2015中用C++编写可被其它语言调用的动态库DLL

    转自:http://blog.csdn.net/songyi160/article/details/50754705 VS2015用C++创建动态库DLL步骤如下: (1)启动VS2015>文件 ...

  8. Java通过jna调用c++动态库

    1 环境准备 操作系统:windows 10,x64 jna,jna-4.4.0.jar c++开发环境,vc2013 java开发环境,eclipse,jdk8 2 dll开发 通过vc2013创建 ...

  9. Unity3D跨平台动态库编译---记kcp基于CMake的各平台构建实践

    一 为什么需要动态库 1)提供原生代码(native code)的支持,也叫原生插件,但是我实践的是c/cpp跨平台动态库,这里不具体涉及安卓平台java库和ios平台的objectc库构建. 2)某 ...

随机推荐

  1. ODAC(V9.5.15) 学习笔记(一)总论

    一直在使用ODAC做开发,没时间仔细研究一下,目前采用的是3层结构,ODAC+TDataSetProvider+TClientDataSet做数据处理,也没有多大问题.下一步要开发B/S的程序了,打算 ...

  2. Ubuntu 18.04 修改gedit的配色方案

    下图中的蓝色的注释代码,真是有点让人瞎眼的感觉 去这个网站 https://github.com/mig/gedit-themes/tree/master 下载所有后解压到/usr/share/gtk ...

  3. WSL及Linux入门

    win10内置linux子系统(Windows Subsystem for Linux),可以不用安装Vmware等虚拟机学习linux啦. wsl开启方式 设置打开开发人员模式. 控制面板-程序和功 ...

  4. 论文笔记:Tracking by Natural Language Specification

    Tracking by Natural Language Specification 2018-04-27 15:16:13  Paper: http://openaccess.thecvf.com/ ...

  5. (转)Introductory guide to Generative Adversarial Networks (GANs) and their promise!

    Introductory guide to Generative Adversarial Networks (GANs) and their promise! Introduction Neural ...

  6. Levenshtein Distance,判断字符串的相似性

    private int LevenshteinDistance(string s1,string s2,int maxValue) { if (s1 == null|| s1.Length == 0) ...

  7. 测试常用的Linux命令总结

    列出常用的命令和最常用的用法,排名不分先后:) 1. find在/home目录下查找以.txt结尾的文件名find /home -name "*.txt"同上,但忽略大小写find ...

  8. POJ 3087 Shuffle'm Up(洗牌)

    POJ 3087 Shuffle'm Up(洗牌) Time Limit: 1000MS    Memory Limit: 65536K Description - 题目描述 A common pas ...

  9. 2、My Scripts

    http://www.cnblogs.com/image-eye/archive/2011/10/26/2220405.html      注释详解 1.打印选择菜单,按照选择项一键安装不同的web服 ...

  10. RESTful 个人理解总结

    一.什么是RESTful 面向资源 简单的说:RESTful是一种架构的规范与约束.原则,符合这种规范的架构就是RESTful架构.   先看REST是什么意思,英文Representational ...