4

所以我在将 Mingw 编译的 C++ dll 添加到我的 msvc 项目时遇到了一些麻烦。我已经解决了一些人似乎有的关于链接的问题,但是现在当我在我添加的 dll 中调用该函数时,我收到“访问冲突读取位置 0x00000014”错误,该错误在 new.cpp 中的 operator new 方法上中断(在视觉工作室 2010 中)。我已经读到内存管理方面存在差异,我想知道这是否可能是我麻烦的根源。

我正在尝试构建和运行的特定 dll 是 cvBlobs,可在此处获得 - https://code.google.com/p/cvblob/,由于某种我不知道的原因,使用 mingw 编译时速度要快很多倍。

我对这些东西很陌生,但我想知道是否会发生 mingw dll 正在调用 msvc new() 方法?那有意义吗?我在 mingw 网站上查看了帮助,虽然这对我来说很有用,但似乎无助于解决这个问题。请让我知道您是否希望我提供其他任何东西。

编辑:我已经从我的 Visual Studio 编译代码中包含了特定的有问题的代码,希望它可以提供一点清晰。

    //Grey is a greyscale image, thresh is that image thresholded
    cvThreshold(grey,thresh,0,255,CV_THRESH_OTSU);
    IplImage* outputImg = cvCreateImage(cvGetSize(thresh), IPL_DEPTH_LABEL, 1);
    //Blobs is where the found blobs are outputted too
    cvb::CvBlobs blobs;
    unsigned int result;
    //This is the problematic method, it is in the mingw compiled dll,
    //other methods from this dll seem to work. I'm tempted to say that
    //the problem comes in the cvLabel method, where a varible "CvBlob blob" is
    //first initalized. This is due to the stack trace that I am including
    //under this edit
    result = cvb::cvLabel(thresh, outputImg, blobs);

这是我在上面提到的堆栈跟踪

cvBlobs.dll!6e313f95()  
[Frames below may be incorrect and/or missing, no symbols loaded for cvBlobs.dll]   
cvBlobs.dll!6e30135b()  
msvcr100d.dll!operator new(unsigned int size)  Line 59C++
nuon.dll!std::_Allocate<std::_Tree_nod<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Node>(unsigned int _Count, std::_Tree_nod<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Node * __formal)  Line 36 + 0x15 bytes C++
nuon.dll!std::allocator<std::_Tree_nod<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Node>::allocate(unsigned int _Count)  Line 187 + 0xb bytes C++
nuon.dll!std::_Tree_val<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Tree_val<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >(const std::less<unsigned int> & _Parg, std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> > _Al)  Line 550 + 0xc bytes  C++
nuon.dll!std::_Tree<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Tree<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >(const std::less<unsigned int> & _Parg, const std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> > & _Al)  Line 699  C++
nuon.dll!std::map<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> > >::map<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> > >()  Line 107    C++
nuon.dll!nuon::MarkerDetector::detect(cv::Mat & input, std::vector<nuon::Marker,std::allocator<nuon::Marker> > & detectedMarkers, nuon::CameraParameters camParams, float markerSizeMeters, bool setYPerperdicular)  Line 201   C++

我希望此编辑可能有助于为某人澄清这一点

4

0 回答 0