Calling c++ from python using ctypes: g++ undefined reference -
Text after "
I have a camera (Thorlabs dcc1645c) that comes with "uc480.lib" to a "uc480.h". I have found this program with my problem with C ++ that I need to use the camera with Python, so I tried to call a C + + class with Python, as Florian pointed out :
This is my c ++ code (cam 2. CPP):
\ # include "uc480.h" of the class Cam {public: UC480_CAMERA_LIST * pucl; Int nNumberOfCameras; Int GetNumberOfCameras () {return is_GetNumberOfCameras (& amp; nNumberOfCameras); }}; Extern "C" {Cam * Cam_new () {New Camera Back); } IntCm_GetNumberOfCameras (Cam * Cam) {cam- & gt; GetNumberOfCameras (); }} I tried to compile with G ++:
G ++ -fPIC -c Cam2.cpp -O Cam2.o G ++ Shared Room - Wl, - Returns an error on the other side: Cam2.o: Cam2 CPP :( .text $ _ZN3Cam18GetNumberOfCamerasEv [Cam :: GetNumberOfCameras ()] 0x1A): `__imp_is_GetNumberOfCameras Undefined Reference ': Error: Collect2.exe ld Return Status of 1 ' is_GetNumberOfCameras' is defined in" Uc480.lib ", so my opinion There is a problem with linking in how can I fix this?
Please tell me, if you have other possibilities to use the camera with the python now.
I am working with memory; This bus, to add the lib file to the link command
G ++ shared room -Wl, -soname, libCam2.so -o libCam2.so uc480.lib as in Cam2.o It may be enough Or, you may have to add an option like -L -luc480 link command, suppose that library is in the same directory as code.
Comments
Post a Comment