Trouble using Loadlibrary with the qhy camera SDK for Windows
Mostrar comentarios más antiguos
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
Respuestas (2)
Garmit Pant
el 2 de Jul. de 2024
0 votos
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!
1 comentario
Walter Roberson
el 7 de Mayo de 2026
Note: The C++ header named <functional> was created in the orignal C++ 98 standard, so this is not a matter of a reference to a new header with an older C++ version.
Most likely, the path to the C++ headers has been messed up (or perhaps was never configured at all.)
Enrico Segre
el 7 de Mayo de 2026
0 votos
Late answering here. You might want to have a look at how I domesticated qhy-provided .h files for loadlibrary, as a part of our observatory driver component for QHY cameras.
Categorías
Más información sobre Troubleshooting in MATLAB Compiler SDK en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!