我正在尝试使用SWIG for C ++代码创建包装文件,并在树莓派Linux平台上的python中调用它。C ++代码在内置函数中包含uEye IDS相机。我正在使用QT Creator和OpenCV。
要生成包装器文件,我使用了source: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);
exam.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;
}