gcc6.3编译c++11的程序链接opencv时字符型函数未定义

在Windows下编写图像处理程序,由于要使用regex,升级了mingw,编译c++11代码。之前代码中使用了opencv2.4.10,一直运行良好,升级编译器以后发现了错误:
undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
原因:
If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro. This commonly happens when linking to a third-party library that was compiled with an older version of GCC. If the third-party library cannot be rebuilt with the new ABI then you will need to recompile your code with the old ABI
Defining the following macro before including any standard library headers should fix your problem:
#define _GLIBCXX_USE_CXX11_ABI 0

原文链接: https://www.cnblogs.com/yangzifb/p/6745081.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    gcc6.3编译c++11的程序链接opencv时字符型函数未定义

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/252868

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月14日 上午6:26
下一篇 2023年2月14日 上午6:27

相关推荐