I am trying to use FFTW library with mex. So far, I have been unable to link them successfully.
I downloaded the latest available pre-compiled packages for windows from FFTW website. Then build the libraries using Visual Studio 2015 cmd, with command * 'lib /machine:x64 /def:libfftw3-3.def'*. A part of my mex file is as follows.
#include <stdlib.h>#include <math.h>#include "C:\Users\wwij0001\Downloads\matlab-mex\q_ldpc_decoding\fftw3.h"#include "mex.h"void q_ldpc_decoder(size_t nc, size_t nv, double Q, double *H, double *y, double R, double z, double *cOnes, double *indexC, double *rOnes, double *indexR, double *perm, double *perm1, double *op){ //check variables----------------------------------------------------------- mexPrintf("nc:%d, nv:%d, Q:%g, R:%g, z:%g\n", nc, nv, Q, R, z); int i, j, k, round, t; double *M; double *MT; double *T_INI; double *V_SUM; double sum; int index, t_index; //create fftw plans--------------------------------------------------------- fftw_plan p = fftw_create_plan(Q, FFTW_FORWARD, FFTW_ESTIMATE);
Now, for building the mex file, I use command,
mex -LC:\Users\wwij0001\Downloads\matlab-mex\q_ldpc_decoding\libfftw3-3.dll -llibfftw3-3.lib q_ldpc_decoder.c
But matlab is giving error,
Error using mex Creating library q_ldpc_decoder.lib and object q_ldpc_decoder.expq_ldpc_decoder.obj : error LNK2019: unresolved external symbol fftw_create_plan referenced in function q_ldpc_decoderq_ldpc_decoder.mexw64 : fatal error LNK1120: 1 unresolved externals
I am using 2016b version.
Best Answer