寫bug嘛,不是,寫代碼嘛,總會出bug的嘛。寫了一週了,遇到好多bug,總結總結吧。
1 .
錯誤 1 error C4996: ‘fopen’: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. c:\program files\opencv\build\include\opencv2\flann\logger.h 66
錯誤 2 error C4996: ‘fopen’: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. c:\program files\opencv\build\include\opencv2\flann\logger.h 66
fopen 的error是VS2012特有,在工程屬性裏將C/C++ 常規選項中的SDL檢查改爲否就好了。
2.
我是在使用MFC寫一個上位機,需要同時用到串口控件和定時器,但是添加串口控件後發現程序只相應串口的事件,不觸發定時器。原來是我添加定時器相應函數時只是將舊的程序複製到新的程序上來,雖然沒有報錯,不過在類構造裏並沒有timer,所以當然不相應啦。正確的方法還是在類嚮導裏添加。
3.
程序卡在:ASSERT(IsWindow(pTemp->m_hWnd)); 出錯,程序編譯並不報錯。
使用了串口控件,但是我是在x64環境下編譯的了,它只能在x86下運行哦。改回x86就好了。