error LNK2019 when trying to use C++ program of CurveLab-2.1.3
Mostrar comentarios más antiguos
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 comentarios
Geoff Hayes
el 23 de Nov. de 2014
Editada: Geoff Hayes
el 23 de Nov. de 2014
Mariem - the error message is telling you that it can't find the definition for the function with the signature
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> > > > > > &)
which is being called in the fdct3d_forward_mex function. Did the download of this toolbox come with other libraries that you need to include in your MEX build? Did you call make lib to build supporting (?) libraries before building the MEX functions with make matab (that is how you are trying to build the MEX function, correct?).
Mariem ZAOUALI
el 24 de Nov. de 2014
Geoff Hayes
el 24 de Nov. de 2014
Is there an h file that has the signature for fdct3d_forward? Have you tried contacting the authors of the code?
Mariem ZAOUALI
el 25 de Nov. de 2014
Editada: Mariem ZAOUALI
el 25 de Nov. de 2014
Walter Roberson
el 23 de En. de 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.
Respuesta aceptada
Más respuestas (1)
Geoff Hayes
el 25 de Nov. de 2014
Editada: Geoff Hayes
el 25 de Nov. de 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.
Categorías
Más información sobre OpenCV Support en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!