Windows下 opencv + Clion + MinGM + CMake编译配置及遇到的各种问题

 

一、各个组件

opencv

官网:https://opencv.org/

博主的版本:3.4.4

MinGw 

Cmake

二、问题汇集

1. error: 'nullptr' was not declared in this scope

\opencv\sources\3rdparty\protobuf\src\google\protobuf\stubs\io_win32.cc:94:15: error: 'nullptr' was not declared in this scope
   return s == nullptr || *s == 0;

解决方案: 

在 cmake-gui 编译配置中:

勾选 ENABLE_CXX11

然后重新Configure -Generate -mingw32-make

2.error C2065: “MF_MT_AAC_PAYLOAD_TYPE”

opencv build with tbb error …\modules\videoio\src\cap_msmf.cpp(257): error C2065: “MF_MT_AAC_PAYLOAD_TYPE”

解决方案:

配置cmake时需要去掉WITH_MSMF和WITH_MSMFDXVA两个选项

3.error: ‘strcpy_s’ undeclared… 

window_w32.cpp: In function 'void icvLoadWindowPos(const char*, CvRect&)'
48: error: 'strcpy_s' was not declared in this scope
error: 'strcat_s'was not declared in this scope

原因 :

原因是mingw下没有strcpy_s函数,这是MSC的方法,mingw中不存在

解决方案:

所以window_w32.cpp文件中的strcpy_s和strcat_s都替换为strncpy和strncat。注意:替换后的函数参数顺序不同,也要调整

如下

 char szKey[1024];
 strncpy( szKey, icvWindowPosRootKey, 1024 );
 strncat( szKey, name , 1024);

 

4.clion win10 msvc opencv报错Process finished with exit code -1073741515 (0xC0000135)

参考:https://blog.csdn.net/weixin_40448140/article/details/104720134
需要在Clion启动时配置库文件路劲

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值