0

我正在尝试使用 SWIG 为 C++ 代码创建一个包装文件,并在树莓派 Linux 平台上的 python 中调用它 C++ 代码在内置函数中包含 uEye IDS 摄像头。我正在使用 QT creator 和 openCV。

要生成包装文件,我使用了源代码:https ://mit-crpg.github.io/OpenMOC/devguide/swig.html ,它适用于普通的 c++ 代码。现在,当我尝试为 IDS 相机生成包装器时,出现错误:导入错误:./filename.so:未定义符号:is_InitCamera。我不确定我应该如何纠正它。

exam.i - 接口文件 -

%module exam
%{
#define SWIG_FILE_WITH_INIT
#include "exam.h"

%}
%include "exam.h"

Exam.h - 头文件 -

#include <iostream>
#include <ueye.h>
#include <opencv2/opencv.hpp>
double cam (int a);

考试.cpp - 源文件 -

#include"exam.h"

using namespace std;
double cam(int a)
{

    int nRet = 0;
        int nMemoryId = 0;
        HIDS hCam = a;
        HWND hWndDisplay = 0;



        nRet = is_InitCamera(&hCam, hWndDisplay);
        if (nRet != IS_SUCCESS)
        {
            cout << "ERROR" << endl;
        }
        else
        {
            cout << "Camera initialisation was successful!" << endl << endl;
        }


        // Disables the hCam camera handle and releases the data structures and memory areas taken up by the uEye camera
        nRet = is_ExitCamera(hCam);
        if (nRet == IS_SUCCESS)
        {
            cout << "The camera has been successfully logged off!" << endl << endl;
        }



        system("pause");
        return 1;
}
4

0 回答 0