吐血的bug:error: no type named ‘type’ in ‘struct std::enable_if<false, void>’

在做自己的程序時候,出現這個錯誤。

usr/include/c++/9/bits/shared_ptr.h:106:8: error: no type named ‘type’ in ‘struct std::enable_if<false, void>106 |  using _Constructible = typename enable_if<
      |        ^~~~~~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp: In instantiation of ‘cv::Ptr<T>::Ptr(const false_type&, Y*) [with Y = const char; T = cv::Formatted; std::false_type = std::integral_constant<bool, false>]’:
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:103:57:   required from ‘cv::Ptr<T>::Ptr(Y*) [with Y = const char; T = cv::Formatted]’
/home/xiaopeng/webserver-test/epoll.cpp:154:38:   required from here
/usr/include/c++/9/bits/shared_ptr.h:129:7: note: candidate: ‘std::shared_ptr<_Tp>::shared_ptr(const std::shared_ptr<_Tp>&) [with _Tp = cv::Formatted]129 |       shared_ptr(const shared_ptr&) noexcept = default;
      |       ^~~~~~~~~~
/usr/include/c++/9/bits/shared_ptr.h:129:18: note:   no known conversion for argument 1 from ‘const char*’ to ‘const std::shared_ptr<cv::Formatted>&129 |       shared_ptr(const shared_ptr&) noexcept = default;
      |                  ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/shared_ptr.h:127:17: note: candidate: ‘constexpr std::shared_ptr<_Tp>::shared_ptr() [with _Tp = cv::Formatted]127 |       constexpr shared_ptr() noexcept : __shared_ptr<_Tp>() { }
      |                 ^~~~~~~~~~
/usr/include/c++/9/bits/shared_ptr.h:127:17: note:   candidate expects 0 arguments, 1 provided
make[2]: *** [CMakeFiles/webserver1.dir/build.make:76:CMakeFiles/webserver1.dir/epoll.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:83:CMakeFiles/webserver1.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2

找了半天,發現是print和printf的原因,
print是opencv自帶的方法,我的程序用了oepncv
using namespace cv;

所以沒有報錯。但是編譯的時候才會出現問題。
因爲我要用的是prtinf
std::printf()

就這一處沒使用std。結果搞了半天。
再次提醒,不要省略std。
尤其是在用notepad等編程序,儘量給所有變量和函數都綁定類,那麼即使出現bug,也能快速定位。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值