我正在尝试将 DLL(使用 MSVC 编译)与 MinGW 编译器一起使用。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;
}
谢谢。