Borrar filtros
Borrar filtros

Error with C++ Mex (Linux) in MatlabData​Array/Vari​ableInfo.h​pp

4 visualizaciones (últimos 30 días)
Amit Maoz
Amit Maoz el 14 de Oct. de 2021
Respondida: Neha el 10 de Mayo de 2024
Hello,
I'm trying to compile a C++ Mex file in Linux + CMake, with Matlab 2020b.
I've followed your guide and included mexAdapter.hpp.
I get this error error: /usr/local/MATLAB/R2020b/extern/include/MatlabDataArray/VariableInfo.hpp(137): error #858: type qualifier on return type is meaningless:
typedef const void(*SymbolInfoSetValueFcnPtr)(detail::RefCounted*, size_t, impl::ArrayImpl*);
Can't compile due to that. Any idea how to fix this?
Thanks,
Amit

Respuestas (1)

Neha
Neha el 10 de Mayo de 2024
Hi Amit,
The error message "error #858: type qualifier on return type is meaningless" points out that applying a type qualifier like const to the return type of a function pointer is not meaningful. In the context of your typedef declaration, the issue arises from trying to make the return type of the function pointer const void. Non-class rvalues (like primitives returned by functions) cannot be modified, so they inherently behave as if they are const, even without being explicitly declared as such.
Hope it helps!

Categorías

Más información sobre Call C++ from MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by