STAR_RUB 2016-10-24 07:46 采纳率: 0%
浏览 1027

小白 求助 关于 OpenCV3.10 中 Qt New Functions 的使用问题

没接触过qt,在编写程序时想做个界面,看见opencv3.10的帮助文档中 提及 Qt New Functions 中的createButton 函数 ,想做个按钮。。结果没找到 createButton ,显示的只有 cvCreateButton。。。用了却显示如下错误。。

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK2019 无法解析的外部符号 cvCreateButton,该符号在函数 main 中被引用 opencv_3.10_test e:\visual studio 2015\Project\opencv_3.10_test\opencv_3.10_test\main.obj 1

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK1120 1 个无法解析的外部命令 opencv_3.10_test e:\visual studio 2015\Project\opencv_3.10_test\x64\Debug\opencv_3.10_test.exe 1

求大神解释。。是这个功能只能在 Qt 项目中使用吗?还是别的问题?。。但我看帮助文档中是直接在main函数中使用的。。

  • 写回答

1条回答

  • STAR_RUB 2016-10-24 07:44
    关注

    代码如下。。是win32控制台程序
    #include
    #include
    #include
    #include

    using namespace cv;

    typedef struct custom_data
    {
    int state;
    } custom_data_t;

    void my_button_cb(int state, void* userdata)
    {
    std::cout << "@my_button_cb" << std::endl;

    // convert userdata to the right type
    custom_data_t* ptr = (custom_data_t*)userdata;
    if (!ptr)
    {
    std::cout << "@my_button_cb userdata is empty" << std::endl;
    return;
    }

    ptr->state = state;

    // unlock mutex

    }

    int main()
    {
    // declare and initialize our userdata
    custom_data_t my_data = { 0 };
    cvCreateButton("dummy_button", my_button_cb, &my_data, CV_PUSH_BUTTON, 0);
    // For testing purposes, go ahead and click the button to activate
    // our callback.

    // waiting for key press on the console to continue the execution
    getchar();

    std::cout << "The state retrieved by the callback is: " << my_data.state << std::endl;

    return 0;
    }

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?