error C2440 While using MATLAB Coder with Custom FFT library callback

2 Ansichten (letzte 30 Tage)
I have simple script function [RetVal] = MatLabFFTW(CapWave) TempVal = fft(CapWave); RetVal = real(sum(TempVal)); end
When I tried to convert this script to DLL using Coder; I got following compilation errors:
Script\codegen\dll\MatLabFFTW\MatLabFFTW.cpp(102) : error C2440: '=' : cannot convert from 'void ' to 'double *'         Conversion from 'void' to pointer to non-'void' requires an explicit cast Script\codegen\dll\MatLabFFTW\MatLabFFTW.cpp(110) : error C2440: '=' : cannot convert from 'void ' to 'fftw_complex (*)'         Conversion from 'void' to pointer to non-'void' requires an explicit cast Script\codegen\dll\MatLabFFTW\MatLabFFTW.cpp(111) : error C2664: 'void fftw_execute_dft_r2c(const fftw_plan,double ,fftw_complex (*))' : cannot convert argument 1 from 'void *' to 'const fftw_plan'         Conversion from 'void' to pointer to non-'void' requires an explicit cast Script\codegen\dll\MatLabFFTW\MatLabFFTW.cpp(146) : error C2440: '=' : cannot convert from 'void ' to 'double *'         Conversion from 'void' to pointer to non-'void' requires an explicit cast Script\codegen\dll\MatLabFFTW\MatLabFFTW.cpp(147) : error C2440: '=' : cannot convert from 'void ' to 'fftw_complex (*)'         Conversion from 'void' to pointer to non-'void' requires an explicit cast Script\codegen\dll\MatLabFFTW\MatLabFFTW.cpp(189) : error C2664: 'void fftw_destroy_plan(fftw_plan)' : cannot convert argument 1 from 'void ' to 'fftw_plan'         Conversion from 'void' to pointer to non-'void' requires an explicit cast
Note: 1) I am using the Custom FFT library callback option to use our own FFTW 2) When select the language as 'C' then there is no problem in compiling the DLL but choosing C++ giving this compiler error 3) I am using Visual Studio 2013 compiler
Please help me to solve this issue.

Akzeptierte Antwort

Ryan Livingston
Ryan Livingston am 19 Dez. 2017
This is a bug and has been reported to the MATLAB Coder development team. Thank you for reporting it.
As you've seen, generating C code will work around the issue.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by