Clear Filters
Clear Filters

Trouble using Loadlibrary with the qhy camera SDK for Windows

3 views (last 30 days)
I am trying to connect MatLab to control my QHY550P camera. I have installed the SDK for windows, which includes several header files, as well as the SDK library, which I am trying to load.
if ~libisloaded("C:\Users\Elina\Documents\MATLAB\pkg_win\x64\qhyccd.dll")
loadlibrary('C:\Users\Elina\Documents\MATLAB\pkg_win\x64\qhyccd.dll', ...
"C:\Users\Elina\Documents\MATLAB\pkg_win\include\qhyccd.h",'addheader', ...
"C:\Users\Elina\Documents\MATLAB\pkg_win\include\qhyccderr.h", 'addheader', ...
"C:\Users\Elina\Documents\MATLAB\pkg_win\include\qhyccdcamdef.h", 'addheader', ...
"C:\Users\Elina\Documents\MATLAB\pkg_win\include\qhyccdstruct.h", 'addheader', ...
"C:\Users\Elina\Documents\MATLAB\pkg_win\include\config.h", 'addheader', ...
"C:\Users\Elina\Downloads\mingw81\x86_64-w64-mingw32\include\stdint.h", 'addheader', ...
"C:\Users\Elina\Documents\MATLAB\pkg_win\include\CyAPI.h")
end
(pkg_win is the sdk folder which I downloaded)
When I try using loadlibrary with the specified h files, I receive an error message:
Error using loadlibrary
Failed to preprocess the input file.
Output from preprocessor is:C:\Users\Elina\Documents\MATLAB\pkg_win\include\qhyccd.h:7:22: fatal error: functional: No such
file or directory
#include <functional>
^
compilation terminated.
I know that this preprocessing error may have to do with the MinGW compiler, which I have downloaded and configured multiple times, but I still receive this same error message. It also may have to do with not including all the required h files(?).
Any help to resolve this would be appreciated,
Thanks in advance

Answers (1)

Garmit Pant
Garmit Pant on 2 Jul 2024
Hello Benji
From what I gather, you are working with an external SDK library, and you want to load the functions to MATLAB using “loadlibrary” function.
The error that you have shared suggests that the compiler that you are using is not able to find the ‘<functional>’ header which is a standard library header.
The issue of missing includes in gcc builds is common for older versions. You can resolve this issue by setting up your compiler correctly. Kindly follow the steps mentioned in the following guide to install the compiler from the MSYS2 build which is very reliable:
Further, please follow the following guide to setup your existing compiler with MATLAB:
After setting up your compiler with a newer build version, importing the functions using “loadlibrary” function should work.
I hope you find the above explanation and suggestions useful!

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!