VS2013配置caffe,调用caffe库

使用VS2013配置caffe,前提是已经有编译好的caffe库。


(CPU、Release版)


1、新建VS2013工程,解决方案配置改为Release

2、项目右键->属性

3、在VC++目录->包含目录中,加入:


D:\caffe-master\include
D:\NugetPackages\boost.1.59.0.0\lib\native\include;
D:\NugetPackages\gflags.2.1.2.1\build\native\include;
D:\NugetPackages\glog.0.3.3.0\build\native\include;
D:\NugetPackages\OpenBLAS.0.2.14.1\lib\native\include;
D:\NugetPackages\OpenCV.2.4.10\build\native\include;
D:\NugetPackages\protobuf-v120.2.6.1\build\native\include;


4、在VC++目录->库目录中,加入:

D:\caffe-master\include
D:\NugetPackages\boost.1.59.0.0\lib\native\include;
D:\NugetPackages\gflags.2.1.2.1\build\native\include;
D:\NugetPackages\glog.0.3.3.0\build\native\include;
D:\NugetPackages\OpenBLAS.0.2.14.1\lib\native\include;
D:\NugetPackages\OpenCV.2.4.10\build\native\include;
D:\NugetPackages\protobuf-v120.2.6.1\build\native\include;

5、在链接器->输入->附加依赖项中,加入:

D:\caffe-master\include
D:\NugetPackages\boost.1.59.0.0\lib\native\include;
D:\NugetPackages\gflags.2.1.2.1\build\native\include;
D:\NugetPackages\glog.0.3.3.0\build\native\include;
D:\NugetPackages\OpenBLAS.0.2.14.1\lib\native\include;
D:\NugetPackages\OpenCV.2.4.10\build\native\include;
D:\NugetPackages\protobuf-v120.2.6.1\build\native\include;

6、C/C++ 预处理器中,添加: 

  

_SCL_SECURE_NO_WARNINGS;CPU_ONLY;

7、解决方案平台改为x64


8、配置完成,可输入以下代码测试:

    #include<iostream>
    #include<caffe/blob.hpp>
    using namespace caffe;
    using namespace std;
    int main()
    {
	Blob<float> blob1;
	cout << "Size : " << blob1.shape_string() << endl;
	blob1.Reshape(1, 2, 3,4);
	cout << "Size : " << blob1.shape_string() << endl;
	return 0;

    }


阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页