error LNK2019 when trying to use C++ program of CurveLab-2.1.3
3 views (last 30 days)
Show older comments
Mariem ZAOUALI
on 23 Nov 2014
Commented: Walter Roberson
on 23 Jan 2016
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
Walter Roberson
on 23 Jan 2016
With respect to compiling Curvelab, see also http://uk.mathworks.com/matlabcentral/answers/263252-how-to-use-mex-files-in-matlab#comment_334471 -- you might need to expand the comments to see it.
Accepted Answer
More Answers (1)
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.
0 Comments
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!