安裝完OpenCV
並在Visual Studio設定好環境變數之後
加入
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"
可能遇到下列錯誤
1>c:\program files\opencv\cxcore\include\cxtypes.h(205) : error C3862: 'cvRound': cannot compile an unmanaged function with /clr:pure or /clr:safe
1> Inline native assembly not supported in managed code
1>c:\program files\opencv\cxcore\include\cxtypes.h(205) : error C3645: 'cvRound' : __clrcall cannot be used on functions compiled to native code
1>c:\program files\opencv\cv\include\cvcompat.h(784) : warning C4819: The file contains a character that cannot be represented in the current code page (950). Save the file in Unicode format to prevent data loss
1>Snake.cpp
1>c:\program files\opencv\cxcore\include\cxtypes.h(205) : error C3862: 'cvRound': cannot compile an unmanaged function with /clr:pure or /clr:safe
1> Inline native assembly not supported in managed code
1>c:\program files\opencv\cxcore\include\cxtypes.h(205) : error C3645: 'cvRound' : __clrcall cannot be used on functions compiled to native code
解決方式如下
對該Project進行設定
Project->Properties->General->Common Language Runtime Support改成/Clr即可
留言
張貼留言