Caffe-Winエラー・コレクションのコンパイル

3391 ワード

CaffeはWindowsでコンパイルするのに多くのトラブルに遭遇しました...
1.visual studio 2013 error C2371: 'int8_t' : redefinition; 導入されたunistd.hファイルにint 8_を再定義しましたt,手帳でファイルを開いてログアウトする.
2. error C3861: 'getpid': identifier not found    C:\Tools\caffe-master\src\caffe\common.cpp 26解決:common.cppにinclude
変更:
   pid = getpid(); ——>pid = _getpid();

3.  error C3861: 'usleep': identifier not found    C:\Tools\caffe-master\src\caffe\test\test_benchmark.cpp    65
参考:ffmpegコンパイルまとめ
      7.「usleep」:identifier not found
ここではVCにはusleepはなく、usleepは微妙なレベルなのでコードを
     usleep(is->audio_st && is->show_audio ? rdftspeed*1000 : 5000);
     —>    Sleep (is->audio_st && is->show_audio ? rdftspeed*1 : 5);
     usleep(300 * 1000); —> Sleep(300);
追加:#include
4. error C3861: 'snprintf': identifier not found    C:\Tools\caffe-master\src\caffe\solver.cpp    331
参照先:http://blog.163.com/wanghuajie@126/blog/static/452312862009111114434838/
solver.cppにinclude
snprintfを_に変更snprintf
5. error C3861: '__builtin_popcount': identifier not found    C:\Tools\caffe-master\src\caffe\util\math_functions.cpp    346
参照先:http://blog.csdn.net/rappy/article/details/1788969       __builtin_PopcountこれはGCCの関数です.32ビットの符号なし整数のビットが1であるかを計算します.
解決:自分で1つの関数を書きますbuiltin_popcount
template <typename Dtype>
unsigned int __builtin_popcount(Dtype u)
{
    u = (u & 0x55555555) + ((u >> 1) & 0x55555555);
    u = (u & 0x33333333) + ((u >> 2) & 0x33333333);
    u = (u & 0x0F0F0F0F) + ((u >> 4) & 0x0F0F0F0F);
    u = (u & 0x00FF00FF) + ((u >> 8) & 0x00FF00FF);
    u = (u & 0x0000FFFF) + ((u >> 16) & 0x0000FFFF);
    return u;
}//wishchin!!!

6.error : identifier "::caffe::kBNLL_THRESHOLD"is undefined in device code    C:\Tools\caffe-master\src\caffe\layers\bnll_layer.cu    36
参照先:
解決:bnll_layer.Cuの修正
        Dtype expval = exp(min(in_data[index], Dtype(kBNLL_THRESHOLD)));
        ——>Dtype expval = exp(min(in_data[index], Dtype(50)));

7. error C2660: 'mkdir' : function does not take 2 arguments    C:\Tools\caffe-master\src\caffe\test\test_data_layer.cpp    71
参照先:
解決:
   CHECK_EQ(mkdir(filename_->c_str(), 0744), 0) << "mkdir " << filename_<< "failed"; 
の2番目のパラメータは削除されます.
8.error C2784: '_Ty std::max(std::initializer_list<_Elem>,_Pr)' : could not de
解決:呼び出し関数でstd::maxを括弧で囲む(std::max)(std::initializer_list<
9.error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS.
参照先:http://www.zhihu.com/question/26242158
解決:属性を追加-D削除する必要があります->cc+->プリプロセッサ->プリプロセッサ定義に追加_SCL_SECURE_NO_WARNINGSのコンパイルに成功し、
XXX:絶えず現れる
error C 1075:end of file found before the left parenthesis'('at'test_infogain_loss_layer.cpp 71もどこか間違っていません.Define文に問題があるはずですが、気にしなくてもいいようですが.......