编译Caffe-Win错误集锦
Caffe在Windows下編譯還是遇到不少麻煩的...
1.visual studio 2013 error C2371: 'int8_t' : redefinition;
??? ? 引入的unistd.h文件里面重定義了int8_t? ,用記事本?打開文件注銷之。
2. error C3861: 'getpid': identifier not found?? ?C:\Tools\caffe-master\src\caffe\common.cpp?? ?26
?????解決:在common.cpp?里面添加 #include <process.h>
???? 修改:
3.? error C3861: 'usleep': identifier not found?? ?C:\Tools\caffe-master\src\caffe\test\test_benchmark.cpp?? ?65
參考:ffmpeg編譯總結(jié)
? ??? 7.出現(xiàn) '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 <windows.h>
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 <stdio.h>
?? 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的函數(shù):計算一個 32 位無符號整數(shù)有多少個位為1?
???? 解決:自己寫一個函數(shù)__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??? 里修改
7. error C2660: 'mkdir' : function does not take 2 arguments?? ?C:\Tools\caffe-master\src\caffe\test\test_data_layer.cpp?? ?71
參考:
?????解決:
8.error C2784: '_Ty std::max(std::initializer_list<_Elem>,_Pr)' : could not de
?????解決:調(diào)用函數(shù)處 把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去掉 屬性-> c\c++ -> 預處理器 -> 預處理器定義 里添加 _SCL_SECURE_NO_WARNINGS 編譯成功 ,
XXX:不斷出現(xiàn)的
??????? error C1075: end of file found before the left parenthesis '(' at '? test_infogain_loss_layer.cpp?? ?71
?????? 也沒有找到哪里錯了。應該是Define語句出現(xiàn)問題, 貌似可以不用管它.............
總結(jié)
以上是生活随笔為你收集整理的编译Caffe-Win错误集锦的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaScript窗口打开与关闭及如何
- 下一篇: 三国志战略版孙坚战法搭配 三国演义第1集