error LNK2019 when trying to use C++ program of CurveLab-2.1.3

8 views (last 30 days)
Hello everyone,
I am working with CurveLab2.1.3 downloaded from this website and I am trying now to generate 'mexw64' file using mex command in Matlab,
I've got this link error after running this command:
mex -largeArrayDims fdct3d_forward_mex.cpp -llibfftw3-3 -llibfftw3f-3 -llibfftw3l-3 -L"C:\fftw-3.3.4-dll64" libfdct3d.a libfftw.a
Création de la bibliothèque C:\Users\mariam\AppData\Local\Temp\mex_pfrp1Y\templib.x et de l'objet C:\Users\mariam\AppData\Local\Temp\mex_pfrp1Y\templib.exp
fdct3d_forward_mex.obj : error LNK2019: symbole externe non résolu "int __cdecl fdct3d_forward(int,int,int,int,int,int,class NumTns<class std::complex<double> > &,class std::vector<class std::vector<class NumTns<class std::complex<double> >,class std::allocator<class NumTns<class std::complex<double> > > >,class std::allocator<class std::vector<class NumTns<class std::complex<double> >,class std::allocator<class NumTns<class std::complex<double> > > > > > &)" (?fdct3d_forward@@YAHHHHHHHAEAV?$NumTns@V?$complex@N@std@@@@AEAV?$vector@V?$vector@V?$NumTns@V?$complex@N@std@@@@V?$allocator@V?$NumTns@V?$complex@N@std@@@@@std@@@std@@V?$allocator@V?$vector@V?$NumTns@V?$complex@N@std@@@@V?$allocator@V?$NumTns@V?$complex@N@std@@@@@std@@@std@@@2@@std@@@Z) référencé dans la fonction mexFunction
fdct3d_forward_mex.mexw64 : fatal error LNK1120: 1 externes non résolus
C:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: Link of 'fdct3d_forward_mex.mexw64' failed.
Error using mex (line 206) Unable to complete successfully.
I would appreciate your help Thank you in advance
  5 Comments
Mariem ZAOUALI
Mariem ZAOUALI on 25 Nov 2014
Edited: Mariem ZAOUALI on 25 Nov 2014
This file uses fdct3d.h. And for emailing the authors, not yet, I thought it was a simple problem .. Thank you again Geoff for your kindness and help

Sign in to comment.

Accepted Answer

Mariem ZAOUALI
Mariem ZAOUALI on 30 Dec 2014
Edited: Mariem ZAOUALI on 30 Dec 2014
I am writing this time to notify that I found a solution to this problem and this is thanks to you Geoff.
I was using Matlab on Windows. I moved on Ubuntu, I compiled my FFTW using
./configure --disable-shared
make
make install
then, I turned to Curvelab project under matlab, and I ran make and make matlab . and my program is successfully running!
Best regards

More Answers (1)

Geoff Hayes
Geoff Hayes on 25 Nov 2014
Edited: Geoff Hayes on 25 Nov 2014
Mariem - I think that the problem has to do with the libfdct3d.a. The command that was used to generate the same MEX file on my computer (R2014a, OS X 10.8.5) is
mex fdct3d_forward_mex.cpp -I/Users/geoff/Development/fftw-2.1.5/fftw libfftw.a libfdct3d.a
which is a much simplified version of the command that your built script (via make matlab) is running (I'm not sure why, but probably has to do with the OS and/or MATLAB version).
Now, if I re-run the command without the libfdct3d.a as
mex fdct3d_forward_mex.cpp -I/Users/geoff/Development/fftw-2.1.5/fftw libfftw.a
I observe an error similar to yours
Undefined symbols for architecture x86_64:
"fdct3d_forward(int, int, int, int, int, int, NumTns<std::complex<double> >&, std::vector<std::vector<NumTns<std::complex<double> >, std::allocator<NumTns<std::complex<double> > > >, std::allocator<std::vector<NumTns<std::complex<double> >, std::allocator<NumTns<std::complex<double> > > > > >&)", referenced from:
_mexFunction in fdct3d_forward_mex.o
ld: symbol(s) not found for architecture x86_64
Can you verify that the libfdct3d.a library has been created? A copy of it should be in the ../CurveLab-2.1.3/fdct3d/src folder.

Community Treasure Hunt

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

Start Hunting!