我正在尝试使用带有MinGW编译器的DLL(使用MSVC编译)。 dll和二进制文件都使用opencv dll编译了相应的编译器(MSVC用于MSVC DLL,MinGW用于MinGW二进制文件)。但是,opencv vesrion是相同的2.42。
我可以成功加载我的DLL(使用extern C),但是从DLL调用SetRect函数会导致以下控制台输出:
Set search rect(qt): 162, 119, 50, 50
(Internal error: pc 0x112 in read in psymtab, but not in symtab.)
(Internal error: pc 0x112 in read in psymtab, but not in symtab.)
(Internal error: pc 0x112 in read in psymtab, but not in symtab.)
(Internal error: pc 0x112 in read in psymtab, but not in symtab.)
Set search rect(dll): 2282800, 2282908, 2282840, 1874777202
(Internal error: pc 0x112 in read in psymtab, but not in symtab.)
(Internal error: pc 0x112 in read in psymtab, but not in symtab.)
(Internal error: pc 0x112 in read in psymtab, but not in symtab.)
(Internal error: pc 0x112 in read in psymtab, but not in symtab.)
为什么数字不同,内部错误是什么以及如何解决?
一些代码,请注意Rect类来自Opencv。
MinGW二进制文件:
std::cout << "Rect(qt): " << rect.x << ", " << rect.y << ", " << rect.width << ", " << rect.height << "\n" << std::flush;
SetRect(rect);
MSVC DLL:
void SetRect(Rect rect)
{
std::cout << ""Rect(dll): " << rect.x << ", " << rect.y << ", " << rect.width << ", " << rect.height << "\n" << std::flush;
}
感谢。
答案 0 :(得分:3)
除非您提供Short, Self Contained, Correct (Compilable), Example。
,否则我们无法重现您的问题我建议您仔细查看MinGW常见问题解答,特别是MSVC and MinGW DLLs部分,因为它涵盖了what you are trying to accomplish。