我剛剛開始使用OpenCV。我下載了OpenCV 2.4.9,並安裝了MSVS 2010.我的Windows是X64。我遵循以下步驟:未處理的異常Microsoft C++異常:cv ::內存位置異常
a。在配置屬性下,單擊調試 - >環境並複製粘貼:PATH = C:\ opencv \ build \ x86 \ vc10 \ bin
b。 VC++目錄 - >包含目錄並添加條目:C:\ opencv \ build \ include
c。 VC++目錄 - >庫目錄並添加條目:C:\ opencv \ build \ x86 \ vc10 \ lib
d。鏈接器 - >輸入 - >附加依賴,並添加以下內容:
opencv_calib3d249.lib;opencv_contrib249.lib;opencv_core249.lib;opencv_features2d249.lib;opencv_flann249.lib;opencv_gpu249.lib;opencv_nonfree249.lib;opencv_highgui249.lib;opencv_imgproc249.lib;opencv_legacy249.lib;opencv_ml249.lib;opencv_objdetect249.lib;opencv_ts249.lib;opencv_video249.lib;
我跑到下面的代碼:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main() {
// read an image
cv::Mat image= cv::imread("img.jpg");
// create image window named "My Image"
cv::namedWindow("My Image");
cv::waitKey(1000);
// show the image on window
cv::imshow("My Image", image);
// wait key for 5000 ms
cv::waitKey(50);
return 1;
}
爲了得到錯誤:
Unhandled exception at 0x76d2b727 in BTP1.exe: Microsoft C++ exception: cv::Exception at memory location 0x003af414
我想這可能是由於X64和x86不匹配。關於更改a中的條目。到PATH = C:\ opencv \ build \ x64 \ vc10 \ bin並在c。到C:\ OpenCV的\建設\ \ VC10 \ lib中,我得到以下錯誤:
The application was unable to start correctly (0xc000007b). Click OK to close the application.
我如何能渡過這個問題有什麼建議?
有時,我也會收到以下錯誤消息:**錯誤LNK1112:模塊機器類型'x64'與目標機器類型'X86'衝突** – tonnerrian 2014-08-31 00:25:57
它甚至到達主的第一行()?如果是這樣,它得到了多少? – 2014-08-31 00:26:16
它的確如此。它也會打開namedWindow,並在提供內存異常之前等待1秒。 – tonnerrian 2014-08-31 00:28:48