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