error C2440 While using MATLAB Coder with Custom FFT library callback

2 次查看(过去 30 天)
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.

采纳的回答

Ryan Livingston
Ryan Livingston 2017-12-19
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by