BVLC 版本
vs2015 + Windows10 + cuda8.0 + cudnn v5.1
1.下载地址:
2.使用 cmake 生成工程,此时 会去下载依赖库 libraries_v140_x64_py35_1.1.0
3.把Altas 改为 Open (在 Ungrouped Entries 里面第一个)
4.重新生成工程即可用VS 进行编译。
注编译 .cu文件 需要把 CUDA C/C++ -> Device-> Code Generation 改为 compute_61,sm_61
HappyNear版本
vs2015 + Windows10 + cuda9.0 + cudnn v5.1
下载网址
https://github.com/happynear/caffe-windows
1.将 CommonSettings.props.example 复制一份 改为 CommonSettings.props
内容:
修改 <!-- CuDNN 3 and 4 are supported -->
<CuDnnPath>D:\CUDA\CuDNNv5</CuDnnPath>
为
<!-- CuDNN 3 and 4 are supported -->
<CuDnnPath>E:\WorkSpace\SoftWare\cudnn-8.0-windows10-x64-v5.1</CuDnnPath>
修改 <PythonSupport>true</PythonSupport>
<!-- NOTE: If Matlab support is enabled, MatlabDir (below) needs to be
set to the root of your Matlab installation. -->
<MatlabSupport>true</MatlabSupport>
<MXNetSupport>true</MXNetSupport>
为
false
2. 将 第三方库文件解压复制到 caffe-windows-ms\windows\thirdparty 目录下
caffe-windows-ms\windows\thirdparty\bins
caffe-windows-ms\windows\thirdparty\Boost
...
...
...
3.将 属性-> C/C++ 常规 将警告视为错误改为否。
###4.取消vcpkg的依赖。。
4. boost 版本换成 1.61.0
<BoostIncludeFolder>$(SolutionDir)thirdparty\Boost</BoostIncludeFolder>
<BoostLibraryFolder>$(SolutionDir)thirdparty\Boost\lib64-msvc-14.0</BoostLibraryFolder>
换成 1.61版本否者会报错:system::error_category::std_category::name(void) const”: 重写虚函数的限制性异常规范比基类虚成员函数“const char *std::error_category::name(void) noexcept const”少
1> E:\WorkSpace\SoftWare\caffe_happynear\caffe-windows-ms\windows\thirdparty\Boost\boost/system/error_code.hpp(233): note: 参见“boost::system::error_category::std_category::name”的声明
vs2015编译boost 64位
---恢复内容开始---
下载 boost: https://www.boost.org/users/history/version_1_61_0.html
step 1: 执行bootstrap.bat,会生成bjam.exe
step 2:
全部编译的命令行:bjam --toolset=msvc-14.0 --build-type=complete stage
部分编译的命令行:bjam --toolset=msvc-14.0 --with-date_time --with-thread
编译成64位的命令:bjam --toolset=msvc-14.0 address-model=64 --build-type=complete stage
查看需要编译库的命令行:bjam --show-libraries
bjam --toolset=msvc-14.0 address-model=64 --with-date_time --with-thread --with-chrono link=static runtime-link=static --stagedir="./bin/vs15_64" release
查看可以编译的库
bjam --show-libraries
Boost :静态库编译
bjam stage --toolset=msvc-14.0 address-model=64 --with-date_time --with-thread --with-system --with-filesystem --stagedir="E:\WorkSpace\caffe_library\boost_1_61_0\installs" link=static threading=multi release
Boost:动态库编译
bjam stage --toolset=msvc-14.0 address-model=64 --with-date_time --with-thread --with-system --with-filesystem --stagedir="E:\WorkSpace\caffe_library\boost_1_61_0\installs" link=shared runtime-link=shared threading=multi release
---恢复内容结束---
step2如果不知道如何选:就直接用这个 bjam.exe address-model=64 根据你是x86还是 x64 进行 修改
注:在cmd 里面执行 最后会输出打印关于库的生成情况。直接双击看不到。
5. 如果 提示 错误 623 error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __cdecl google::FlagRegisterer::FlagRegisterer(char const *,char const *,char const *,char const *,void *,void *)" (__imp_??0FlagRegisterer@google@@QEAA@PEBD000PEAX1@Z) F:\caffe-windows-master\build_cpu_only\MSVC\caffe.obj caffe
把CommonSettings.props里面的 gflags.lib 改为 gflags_nothreads.lib
其他错误可参考