Integrate C++ Basler camera libraries in Matlab on Mac
Show older comments
How do I integrate C++ libraries into Matlab 2018b (macOS Mojave ) to use them with the mex() function. Currently I want to use the C++ library of a Basler camera to address it with mex. For this I have to include the following files:
- *.framework
- Header Files
- *.dylib Files
Otherwise the #include call in the c++ file wont work. I have integrated the libraries without problems in QT Creator with the following commands and the #include <pylon/...> works fine
mac: LIBS += -F$$PWD/../../../../../../Library/Frameworks/ -framework pylon
macx: LIBS += -L$$PWD/../../../../../../Library/Frameworks/pylon.framework/Versions/A/Libraries/ -lLog_gcc_v3_1_Basler_pylon_v5_1
macx: LIBS += -L$$PWD/../../../../../../Library/Frameworks/pylon.framework/Versions/A/Libraries/ -lGenApi_gcc_v3_1_Basler_pylon_v5_1
INCLUDEPATH += $$PWD/../../../../../../Library/Frameworks/pylon.framework/Headers/GenICam
DEPENDPATH += $$PWD/../../../../../../Library/Frameworks/pylon.framework/Headers/GenICam
INCLUDEPATH += $$PWD/../../../../../../Library/Frameworks/pylon.framework/Versions/A/Libraries
DEPENDPATH += $$PWD/../../../../../../Library/Frameworks/pylon.framework/Versions/A/Libraries
QMAKE_CXXFLAGS += -F/Library/Frameworks
In Matlab I tried to do it this way, but it doesn't work and there is an error when calling the library in the c++ file:
ipath_1 = '-I/Library/Frameworks';
ipath_2 = '-I/Library/Frameworks/pylon.framework/Headers/GenICam';
ipath_3 = '-I/Library/Frameworks/pylon.framework/Versions/A/Libraries';
lib_1 = '-L/Library/Frameworks/pylon.framework/Versions/A/Libraries/ -lLog_gcc_v3_1_Basler_pylon_v5_1';
lib_2 = '-L/Library/Frameworks/pylon.framework/Versions/A/Libraries/ -lGCBase_gcc_v3_1_Basler_pylon_v5_1';
lib_3 = '-L/Library/Frameworks/pylon.framework/Versions/A/Libraries/ -lGenApi_gcc_v3_1_Basler_pylon_v5_1';
mex('-largeArrayDims',...
'-c',...
ipath_1, ipath_2, ipath_3,...
lib_1, lib_2, lib_3,...
'basler_set_get.cpp')
% Error:
% #include <pylon/PylonIncludes.h>
% ^~~~~~~~~~~~~~~~~~~~~~~
% 1 error generated.
How can I manage the integration in Matlab ?
Answers (0)
Categories
Find more on GenICam Interface in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!